Sha256: fe641324d938ad92c7e27602dfde41e34d8a6713de481b207209f052ce4b45c4

Contents?: true

Size: 895 Bytes

Versions: 1

Compression:

Stored size: 895 Bytes

Contents

# Only allow this backend if ActiveSupport::JSON is already loaded
raise LoadError, "ActiveSupport::JSON isn't available. require 'activesupport/json'" unless defined?(ActiveSupport::JSON)

module OEmbed
  module Formatter
    module JSON
      module Backends
        module ActiveSupportJSON
          ParseError = ::ActiveSupport::JSON.parse_error
          extend self

          # Parses a JSON string or IO and convert it into an object.
          def decode(json)
            ::ActiveSupport::JSON.decode(json)
          end
        
        end
      end
    end
  end
end

# Only allow this backend if it parses JSON strings the way we expect it to
begin
  raise unless OEmbed::Formatter.test_backend(OEmbed::Formatter::JSON::Backends::ActiveSupportJSON)
rescue
  raise LoadError, "The version of ActiveSupport::JSON you have installed isn't parsing JSON like ruby-oembed expected."
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-oembed-0.8.1 lib/oembed/formatter/json/backends/activesupportjson.rb