Class: Zena::Use::Relations::ProxyLoader
- Inherits:
-
Object
- Object
- Zena::Use::Relations::ProxyLoader
- Includes:
- RubyLess
- Defined in:
- lib/zena/use/relations.rb
Overview
The ProxyLoader is used so that nested_attributes_alias resolution through node.send(‘link’).send(‘friend’) makes it to the ‘friend’ relation proxy.
Constant Summary collapse
- DUMMY =
Class.new do def other_id; nil; end def other_ids; []; end def other_zips; []; end def to_s; 'nil'; end def try(*args); nil; end end.new.freeze
Instance Method Summary collapse
- #[](role) ⇒ Object
-
#initialize(node) ⇒ ProxyLoader
constructor
A new instance of ProxyLoader.
- #method_missing(sym, *args) ⇒ Object
- #send(role) ⇒ Object
Constructor Details
#initialize(node) ⇒ ProxyLoader
Returns a new instance of ProxyLoader.
19 20 21 |
# File 'lib/zena/use/relations.rb', line 19 def initialize(node) @node = node end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args) ⇒ Object
31 32 33 |
# File 'lib/zena/use/relations.rb', line 31 def method_missing(sym, *args) nil end |
Instance Method Details
#[](role) ⇒ Object
23 24 25 |
# File 'lib/zena/use/relations.rb', line 23 def [](role) @node.relation_proxy(role.to_s) || DUMMY end |
#send(role) ⇒ Object
27 28 29 |
# File 'lib/zena/use/relations.rb', line 27 def send(role) @node.relation_proxy(role.to_s) end |