MultiJson

Some parts adapted from golang.org/src/pkg/json/decode.go and golang.org/src/pkg/utf8/utf8.go

Public Class Methods

default_adapter() click to toggle source

The default adapter based on what you currently have loaded and installed. First checks to see if any adapters are already loaded, then checks to see which are installed if none are loaded.

# File lib/multi_json.rb, line 26
def default_adapter
  return :oj if defined?(::Oj)
  return :yajl if defined?(::Yajl)
  return :json_gem if defined?(::JSON)

  REQUIREMENT_MAP.each do |(library, adapter)|
    begin
      require library
      return adapter
    rescue LoadError
      next
    end
  end

  Kernel.warn "[WARNING] MultiJson is using the default adapter (ok_json). We recommend loading a different JSON library to improve performance."
  :ok_json
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.