Class: Guacamole::Proxies::Relation
- Defined in:
- lib/guacamole/proxies/relation.rb
Instance Method Summary collapse
-
#initialize(model, edge_class, options = {}) ⇒ Relation
constructor
A new instance of Relation.
Methods inherited from Proxy
#init, #method_missing, #respond_to_missing?, #target
Constructor Details
#initialize(model, edge_class, options = {}) ⇒ Relation
Returns a new instance of Relation.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/guacamole/proxies/relation.rb', line 9 def initialize(model, edge_class, = {}) responsible_edge_collection = EdgeCollection.for(edge_class) direction = [:inverse] ? :inbound : :outbound if [:just_one] init model, -> () { responsible_edge_collection.neighbors(model, direction).to_a.first } else init model, -> () { responsible_edge_collection.neighbors(model, direction) } end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Guacamole::Proxies::Proxy