module OEmbed::Formatter::JSON
Handles parsing JSON
values using the best available backend.
Constants
- DECODERS
A Array of all available backends, listed in order of preference.
Public Class Methods
backend()
click to toggle source
Returns the current JSON
backend.
# File lib/oembed/formatter/json.rb, line 12 def backend set_default_backend unless defined?(@backend) raise OEmbed::FormatNotSupported, :json unless defined?(@backend) @backend end
set_default_backend()
click to toggle source
# File lib/oembed/formatter/json.rb, line 18 def set_default_backend DECODERS.find do |name| begin self.backend = name true rescue LoadError # Try next decoder. false end end end
Private Class Methods
backend_path()
click to toggle source
# File lib/oembed/formatter/json.rb, line 32 def backend_path 'json/backends' end
test_value()
click to toggle source
# File lib/oembed/formatter/json.rb, line 36 def test_value <<-JSON {"version":"1.0", "string":"test", "int":42,"html":"<i>Cool's</i>\\n the \\"word\\"\\u0021"} JSON end