Class: Valkyrie::Persistence::Shared::JSONValueMapper::NestedRecord
- Inherits:
-
ValueMapper
- Object
- ValueMapper
- Valkyrie::Persistence::Shared::JSONValueMapper::NestedRecord
- Defined in:
- lib/valkyrie/persistence/shared/json_value_mapper.rb
Overview
Converts nested records into Resources
Instance Attribute Summary
Attributes inherited from ValueMapper
Class Method Summary collapse
-
.handles?(value) ⇒ Boolean
Determines whether or not a value is a Hash containing multiple keys.
Instance Method Summary collapse
-
#result ⇒ Hash
Generates a Hash derived from the JSON for the value.
Methods inherited from ValueMapper
Constructor Details
This class inherits a constructor from Valkyrie::ValueMapper
Class Method Details
.handles?(value) ⇒ Boolean
Determines whether or not a value is a Hash containing multiple keys
95 96 97 |
# File 'lib/valkyrie/persistence/shared/json_value_mapper.rb', line 95 def self.handles?(value) value.is_a?(Hash) && value.keys.length > 1 end |
Instance Method Details
#result ⇒ Hash
Generates a Hash derived from the JSON for the value
101 102 103 |
# File 'lib/valkyrie/persistence/shared/json_value_mapper.rb', line 101 def result Valkyrie::Persistence::Shared::JSONValueMapper.new(value).result.symbolize_keys end |