Module: OEmbed::Formatter::JSON::Backends::JSONGem

Extended by:
JSONGem
Included in:
JSONGem
Defined in:
lib/oembed/formatter/json/backends/jsongem.rb

Constant Summary collapse

ParseError =
::JSON::ParserError

Instance Method Summary collapse

Instance Method Details

#decode(json) ⇒ Object

Parses a JSON string or IO and convert it into an object.



13
14
15
16
17
18
# File 'lib/oembed/formatter/json/backends/jsongem.rb', line 13

def decode(json)
  if json.respond_to?(:read)
    json = json.read
  end
  ::JSON.parse(json)
end