Class: Shaf::Parser::Json

Inherits:
Base
  • Object
show all
Defined in:
lib/shaf/parser/json.rb

Instance Attribute Summary

Attributes inherited from Base

#body, #request

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize, mime_type

Constructor Details

This class inherits a constructor from Shaf::Parser::Base

Class Method Details

.can_handle?(request) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/shaf/parser/json.rb', line 7

def self.can_handle?(request)
  request.content_type&.match? %r{application/(.*\+)?json}
end

Instance Method Details

#callObject



11
12
13
# File 'lib/shaf/parser/json.rb', line 11

def call
  @payload ||= parse_json
end