Class: PanStuff::Serializer::HashSerializer
- Inherits:
-
Object
- Object
- PanStuff::Serializer::HashSerializer
- Includes:
- Base
- Defined in:
- lib/pan_stuff/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.
10 11 12 13 14 15 16 17 |
# File 'lib/pan_stuff/serializer/hash_serializer.rb', line 10 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.
8 9 10 |
# File 'lib/pan_stuff/serializer/hash_serializer.rb', line 8 def hash @hash end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
8 9 10 |
# File 'lib/pan_stuff/serializer/hash_serializer.rb', line 8 def @message end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
8 9 10 |
# File 'lib/pan_stuff/serializer/hash_serializer.rb', line 8 def @meta end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
8 9 10 |
# File 'lib/pan_stuff/serializer/hash_serializer.rb', line 8 def root @root end |
Instance Method Details
#data ⇒ Object
19 20 21 |
# File 'lib/pan_stuff/serializer/hash_serializer.rb', line 19 def data hash end |