Class: RSchema::Coercers::FixedHash::SymbolizeKeys

Inherits:
Object
  • Object
show all
Defined in:
lib/rschema/coercers/fixed_hash/symbolize_keys.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fixed_hash_schema) ⇒ SymbolizeKeys


14
15
16
17
# File 'lib/rschema/coercers/fixed_hash/symbolize_keys.rb', line 14

def initialize(fixed_hash_schema)
  #TODO: make fixed hash attributes frozen, and eliminate dup
  @hash_attributes = fixed_hash_schema.attributes.map(&:dup)
end

Instance Attribute Details

#hash_attributesObject (readonly)

Returns the value of attribute hash_attributes


8
9
10
# File 'lib/rschema/coercers/fixed_hash/symbolize_keys.rb', line 8

def hash_attributes
  @hash_attributes
end

Class Method Details

.build(schema) ⇒ Object


10
11
12
# File 'lib/rschema/coercers/fixed_hash/symbolize_keys.rb', line 10

def self.build(schema)
  new(schema)
end

Instance Method Details

#call(value) ⇒ Object


19
20
21
# File 'lib/rschema/coercers/fixed_hash/symbolize_keys.rb', line 19

def call(value)
  Result.success(symbolize_keys(value))
end