Method: Hanami::API::Block::Context#call
- Defined in:
- lib/hanami/api/block/context.rb
#call ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/hanami/api/block/context.rb', line 138 def call case caught in String => body [status, headers, [body]] in Enumerator => body [status, headers, body] in Integer => status # # NOTE: It must use `self.body` so it will pick the method defined above. # # If `self` isn't enforced, Ruby will try to bind `body` to # the current pattern matching context. # When that happens, the body that was manually set is ignored, # which results in a bug. [status, headers, [self.body || http_status(status)]] in [Integer => status, String => body] [status, headers, [body]] in [Integer => status, Enumerator => body] [status, headers, body] in [Integer => status, Hash => caught_headers, String => body] headers.merge!(caught_headers) [status, headers, [body]] in [Integer => status, Hash => caught_headers, Enumerator => body] headers.merge!(caught_headers) [status, headers, body] end end |