Class: PiResources::Serializer::HashSerializer
- Inherits:
-
Object
- Object
- PiResources::Serializer::HashSerializer
- Includes:
- Base
- Defined in:
- lib/pi_resources/serializer/hash_serializer.rb
Direct Known Subclasses
Constant Summary
Constants included from Base
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(resource, meta: nil, message: nil, context: nil, root: true) ⇒ HashSerializer
constructor
A new instance of HashSerializer.
Methods included from Base
#as_json, #run_key_transform!, #to_h
Constructor Details
#initialize(resource, meta: nil, message: nil, context: nil, root: true) ⇒ HashSerializer
Returns a new instance of HashSerializer.
14 15 16 17 18 19 20 21 |
# File 'lib/pi_resources/serializer/hash_serializer.rb', line 14 def initialize(resource, meta: nil, message: nil, context: nil, root: true) @hash = resource @resource = resource @meta = @message = @context = context || {} @root = root end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
12 13 14 |
# File 'lib/pi_resources/serializer/hash_serializer.rb', line 12 def hash @hash end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
12 13 14 |
# File 'lib/pi_resources/serializer/hash_serializer.rb', line 12 def @message end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
12 13 14 |
# File 'lib/pi_resources/serializer/hash_serializer.rb', line 12 def @meta end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
12 13 14 |
# File 'lib/pi_resources/serializer/hash_serializer.rb', line 12 def root @root end |
Instance Method Details
#data ⇒ Object
23 24 25 |
# File 'lib/pi_resources/serializer/hash_serializer.rb', line 23 def data hash end |