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
130 131 132 |
# File 'lib/valkyrie/persistence/shared/json_value_mapper.rb', line 130 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
136 137 138 |
# File 'lib/valkyrie/persistence/shared/json_value_mapper.rb', line 136 def result Valkyrie::Persistence::Shared::JSONValueMapper.new(value).result.symbolize_keys end |