Module: RackLintPatch::AllowStringSubclass

Defined in:
actionpack/lib/action_controller/rack_lint_patch.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
# File 'actionpack/lib/action_controller/rack_lint_patch.rb', line 7

def self.included(base)
  base.send :alias_method, :each, :each_with_hack
end

Instance Method Details

#each_with_hackObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'actionpack/lib/action_controller/rack_lint_patch.rb', line 11

def each_with_hack
  @closed = false

  @body.each { |part|
    assert("Body yielded non-string value #{part.inspect}") {
      part.kind_of?(String)
    }
    yield part
  }

  if @body.respond_to?(:to_path)
    assert("The file identified by body.to_path does not exist") {
      ::File.exist? @body.to_path
    }
  end
end