Class: Etna::Clients::Magma::Documents
- Inherits:
-
Object
- Object
- Etna::Clients::Magma::Documents
- Defined in:
- lib/etna/clients/magma/models.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #+(other) ⇒ Object
- #document(document_key) ⇒ Object
- #document_keys ⇒ Object
-
#initialize(raw = {}) ⇒ Documents
constructor
A new instance of Documents.
Constructor Details
#initialize(raw = {}) ⇒ Documents
Returns a new instance of Documents.
344 345 346 |
# File 'lib/etna/clients/magma/models.rb', line 344 def initialize(raw = {}) @raw = raw end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
342 343 344 |
# File 'lib/etna/clients/magma/models.rb', line 342 def raw @raw end |
Instance Method Details
#+(other) ⇒ Object
352 353 354 |
# File 'lib/etna/clients/magma/models.rb', line 352 def +(other) Documents.new({}.update(raw).update(other.raw)) end |
#document(document_key) ⇒ Object
356 357 358 359 360 361 362 |
# File 'lib/etna/clients/magma/models.rb', line 356 def document(document_key) if document_key.is_a?(String) raw[document_key] else raw[document_key&.to_s] end end |
#document_keys ⇒ Object
348 349 350 |
# File 'lib/etna/clients/magma/models.rb', line 348 def document_keys raw.keys end |