Class: ApiBlueprint::Parser

Inherits:
Struct
  • Object
show all
Defined in:
lib/api-blueprint/parser.rb

Instance Method Summary collapse

Methods inherited from Struct

new

Instance Method Details

#parse(body) ⇒ Object

 Nothing special here. Write a class which overrides #parse to make a custom parser.



6
7
8
9
10
# File 'lib/api-blueprint/parser.rb', line 6

def parse(body)
  body.is_a?(String) ? JSON.parse(body) : body
rescue JSON::ParserError
  {}
end