Module: Aws::Json Private

Defined in:
lib/aws-sdk-core/json.rb,
lib/aws-sdk-core/json/parser.rb,
lib/aws-sdk-core/json/builder.rb,
lib/aws-sdk-core/json/handler.rb,
lib/aws-sdk-core/json/oj_engine.rb,
lib/aws-sdk-core/json/json_engine.rb,
lib/aws-sdk-core/json/error_handler.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Modules: JsonEngine, OjEngine Classes: Builder, ErrorHandler, Handler, ParseError, Parser

Class Method Summary collapse

Class Method Details

.dump(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



46
47
48
# File 'lib/aws-sdk-core/json.rb', line 46

def dump(value)
  @engine.dump(value)
end

.engineClass

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the default engine. One of:

Returns:



37
38
39
40
# File 'lib/aws-sdk-core/json.rb', line 37

def engine
  set_default_engine unless @engine
  @engine
end

.engine=(engine) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • engine (Symbol, Class)

    Must be one of the following values:

    • :oj

    • :json



27
28
29
# File 'lib/aws-sdk-core/json.rb', line 27

def engine=(engine)
  @engine = Class === engine ? engine : load_engine(engine)
end

.load(json) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



42
43
44
# File 'lib/aws-sdk-core/json.rb', line 42

def load(json)
  @engine.load(json)
end

.set_default_engineObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



50
51
52
53
54
55
56
57
58
59
# File 'lib/aws-sdk-core/json.rb', line 50

def set_default_engine
  [:oj, :json].each do |name|
    @engine ||= try_load_engine(name)
  end
  unless @engine
    raise 'Unable to find a compatible json library. ' \
    'Ensure that you have installed or added to your Gemfile one of ' \
    'oj or json'
  end
end