Class: Lurch::Relationship::HasOne
- Inherits:
-
Lurch::Relationship
- Object
- Lurch::Relationship
- Lurch::Relationship::HasOne
- Defined in:
- lib/lurch/relationship/has_one.rb
Instance Attribute Summary
Attributes inherited from Lurch::Relationship
Instance Method Summary collapse
-
#initialize(store, relationship_key, document) ⇒ HasOne
constructor
A new instance of HasOne.
- #inspect ⇒ Object
Methods inherited from Lurch::Relationship
from_document, #loaded?, #method_missing, #respond_to_missing?
Constructor Details
#initialize(store, relationship_key, document) ⇒ HasOne
Returns a new instance of HasOne.
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/lurch/relationship/has_one.rb', line 4 def initialize(store, relationship_key, document) @store = store @relationship_key = relationship_key if document["data"].nil? @data = nil else @type = Inflector.decode_type(document["data"]["type"]) @id = document["data"]["id"] @data = Resource.new(@store, @type, @id) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Lurch::Relationship