Module: Hobby::JSON

Defined in:
lib/hobby/json.rb

Defined Under Namespace

Classes: Response

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(app) ⇒ Object



5
6
7
8
# File 'lib/hobby/json.rb', line 5

def self.included app
  app.use Rack::ContentType, 'application/json'
  app.response = Response
end

Instance Method Details

#jsonObject



16
17
18
# File 'lib/hobby/json.rb', line 16

def json
  @json ||= ::JSON.parse request.body.read
end