class SinatraOnlyJSON::JSONStringify
Public Class Methods
new(app)
click to toggle source
# File lib/sinatra/only-json.rb, line 7 def initialize(app) @app = app end
Public Instance Methods
call(env)
click to toggle source
# File lib/sinatra/only-json.rb, line 11 def call(env) status, headers, body = @app.call(env) if %w(GET PUT POST DELETE PATCH).index(env["REQUEST_METHOD"]) return status, headers, [body.to_json] else return status, headers, body end end