class Shale::Mapping::KeyValue

Mapping for key/value serialization formats (Hash/JSON/YAML)

@api private

Attributes

keys[R]

Return keys mapping hash

@return [Hash]

@api private

Public Class Methods

new() click to toggle source

Initialize instance

@api private

Calls superclass method
# File lib/shale/mapping/key_value.rb, line 21
def initialize
  super
  @keys = {}
end

Public Instance Methods

initialize_dup(other) click to toggle source

@api private

Calls superclass method
# File lib/shale/mapping/key_value.rb, line 40
def initialize_dup(other)
  @keys = other.instance_variable_get('@keys').dup
  super
end
map(key, to: nil, using: nil) click to toggle source

Map key to attribute

@param [String] key Document’s key @param [Symbol] to Object’s attribute

@raise [IncorrectMappingArgumentsError] when arguments are incorrect

@api private

# File lib/shale/mapping/key_value.rb, line 34
def map(key, to: nil, using: nil)
  validate_arguments(key, to, using)
  @keys[key] = to || using
end