Class: LightSerializer::HashedObject
- Inherits:
-
Object
- Object
- LightSerializer::HashedObject
- Includes:
- LightSerializer::Helpers::WithCustomRoot
- Defined in:
- lib/light_serializer/hashed_object.rb
Constant Summary collapse
- UnknownAttribute =
Class.new(RuntimeError)
Instance Attribute Summary collapse
-
#raw_object ⇒ Object
readonly
Returns the value of attribute raw_object.
-
#serializer ⇒ Object
readonly
Returns the value of attribute serializer.
Class Method Summary collapse
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(raw_object, serializer) ⇒ HashedObject
constructor
A new instance of HashedObject.
Methods included from LightSerializer::Helpers::WithCustomRoot
Constructor Details
#initialize(raw_object, serializer) ⇒ HashedObject
Returns a new instance of HashedObject.
15 16 17 18 |
# File 'lib/light_serializer/hashed_object.rb', line 15 def initialize(raw_object, serializer) @raw_object = raw_object @serializer = serializer end |
Instance Attribute Details
#raw_object ⇒ Object (readonly)
Returns the value of attribute raw_object.
9 10 11 |
# File 'lib/light_serializer/hashed_object.rb', line 9 def raw_object @raw_object end |
#serializer ⇒ Object (readonly)
Returns the value of attribute serializer.
9 10 11 |
# File 'lib/light_serializer/hashed_object.rb', line 9 def serializer @serializer end |
Class Method Details
.get(*args) ⇒ Object
11 12 13 |
# File 'lib/light_serializer/hashed_object.rb', line 11 def self.get(*args) new(*args).get end |
Instance Method Details
#get ⇒ Object
20 21 22 |
# File 'lib/light_serializer/hashed_object.rb', line 20 def get with_custom_root(serializer.root) { transform_to_hash(raw_object) } end |