Class: Dato::Local::JsonApiMeta
- Inherits:
-
Object
- Object
- Dato::Local::JsonApiMeta
- Defined in:
- lib/dato/local/json_api_meta.rb
Instance Attribute Summary collapse
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(payload) ⇒ JsonApiMeta
constructor
A new instance of JsonApiMeta.
- #respond_to_missing?(method, include_private = false) ⇒ Boolean
Constructor Details
#initialize(payload) ⇒ JsonApiMeta
Returns a new instance of JsonApiMeta.
8 9 10 |
# File 'lib/dato/local/json_api_meta.rb', line 8 def initialize(payload) @payload = payload || {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *arguments, &block) ⇒ Object (private)
26 27 28 29 30 31 32 33 34 |
# File 'lib/dato/local/json_api_meta.rb', line 26 def method_missing(method, *arguments, &block) return super unless arguments.empty? if @payload.key?(method) @payload[method] else super end end |
Instance Attribute Details
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
6 7 8 |
# File 'lib/dato/local/json_api_meta.rb', line 6 def payload @payload end |
Instance Method Details
#[](key) ⇒ Object
12 13 14 |
# File 'lib/dato/local/json_api_meta.rb', line 12 def [](key) @payload[key] end |
#respond_to_missing?(method, include_private = false) ⇒ Boolean
16 17 18 19 20 21 22 |
# File 'lib/dato/local/json_api_meta.rb', line 16 def respond_to_missing?(method, include_private = false) if @payload.key?(method) true else super end end |