class RestCore::SmashResponse
Public Class Methods
members()
click to toggle source
# File lib/rest-core/middleware/smash_response.rb, line 6 def self.members; [:smash_response]; end
Public Instance Methods
call(env) { |merge(RESPONSE_BODY => smash)| ... }
click to toggle source
# File lib/rest-core/middleware/smash_response.rb, line 9 def call env, &k return app.call(env, &k) if env[DRY] return app.call(env, &k) unless smash_response(env) app.call(env){ |res| if res[RESPONSE_BODY].kind_of?(Hash) yield(res.merge(RESPONSE_BODY => Smash.new(res[RESPONSE_BODY]))) else yield(res) end } end