Project

General

Profile

Patch #32308 » yield.patch

Pavel Rosický, 2019-10-21 13:32

View differences:

app/controllers/application_controller.rb (working copy)
486 486
      if args.any?
487 487
        redirect_to *args
488 488
      elsif block_given?
489
        block.call
489
        yield
490 490
      else
491 491
        raise "#redirect_to_referer_or takes arguments or a block"
492 492
      end
lib/redmine/scm/adapters/abstract_adapter.rb (working copy)
249 249
              IO.popen(cmd, mode) do |io|
250 250
                io.set_encoding("ASCII-8BIT") if io.respond_to?(:set_encoding)
251 251
                io.close_write unless options[:write_stdin]
252
                block.call(io) if block_given?
252
                yield(io) if block_given?
253 253
              end
254 254
            rescue => e
255 255
              msg = strip_credential(e.message)
lib/redmine/views/builders.rb (working copy)
32 32
            raise "No builder for format #{format}"
33 33
          end
34 34
        if block
35
          block.call(builder)
35
          yield(builder)
36 36
        else
37 37
          builder
38 38
        end
lib/redmine/views/builders/structure.rb (working copy)
32 32

  
33 33
        def array(tag, options={}, &block)
34 34
          @struct << []
35
          block.call(self)
35
          yield(self)
36 36
          ret = @struct.pop
37 37
          @struct.last[tag] = ret
38 38
          @struct.last.merge!(options) if options
test/functional/repositories_git_controller_test.rb (working copy)
689 689
  def with_cache(&block)
690 690
    before = ActionController::Base.perform_caching
691 691
    ActionController::Base.perform_caching = true
692
    block.call
692
    yield
693 693
    ActionController::Base.perform_caching = before
694 694
  end
695 695
end
test/unit/lib/redmine/views/builders/json_test.rb (working copy)
110 110

  
111 111
  def assert_json_output(expected, &block)
112 112
    builder = Redmine::Views::Builders::Json.new(ActionDispatch::TestRequest.create, ActionDispatch::TestResponse.create)
113
    block.call(builder)
113
    yield(builder)
114 114
    assert_equal(expected, ActiveSupport::JSON.decode(builder.output))
115 115
  end
116 116
end
test/unit/lib/redmine/views/builders/xml_test.rb (working copy)
63 63

  
64 64
  def assert_xml_output(expected, &block)
65 65
    builder = Redmine::Views::Builders::Xml.new(ActionDispatch::TestRequest.create, ActionDispatch::TestResponse.create)
66
    block.call(builder)
66
    yield(builder)
67 67
    assert_equal('<?xml version="1.0" encoding="UTF-8"?>' + expected, builder.output)
68 68
  end
69 69
end
(1-1/2)