Class: Lurch::Relationship::Linked
- Inherits:
-
Lurch::Relationship
- Object
- Lurch::Relationship
- Lurch::Relationship::Linked
- Defined in:
- lib/lurch/relationship/linked.rb
Instance Attribute Summary
Attributes inherited from Lurch::Relationship
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(store, relationship_key, document) ⇒ Linked
constructor
A new instance of Linked.
-
#inspect ⇒ Object
def filter(*args) @store.query.link(@href).filter(*args) end.
Methods inherited from Lurch::Relationship
from_document, #loaded?, #method_missing, #respond_to_missing?
Constructor Details
#initialize(store, relationship_key, document) ⇒ Linked
Returns a new instance of Linked.
4 5 6 7 8 |
# File 'lib/lurch/relationship/linked.rb', line 4 def initialize(store, relationship_key, document) @store = store @relationship_key = relationship_key @href = document["links"]["related"] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Lurch::Relationship
Instance Method Details
#fetch ⇒ Object
10 11 12 |
# File 'lib/lurch/relationship/linked.rb', line 10 def fetch @data = @store.load_from_url(@href) end |
#inspect ⇒ Object
def filter(*args)
@store.query.link(@href).filter(*args)
end
def include(*args)
@store.query.link(@href).include(*args)
end
def fields(*args)
@store.query.link(@href).fields(*args)
end
def sort(*args)
@store.query.link(@href).sort(*args)
end
def page(*args)
@store.query.link(@href).page(*args)
end
34 35 36 37 |
# File 'lib/lurch/relationship/linked.rb', line 34 def inspect suffix = loaded? ? " \"loaded\"" : "" "#<#{self.class} href: #{@href.inspect}#{suffix}>" end |