Class: Filemaker::Model::Relations::Proxy
- Inherits:
-
Object
- Object
- Filemaker::Model::Relations::Proxy
- Defined in:
- lib/filemaker/model/relations/proxy.rb
Overview
A proxy is a class to send all unknown methods to it’s target. The target here will be the eventual associated model.
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize(owner, name, options) ⇒ Proxy
constructor
A new instance of Proxy.
- #method_missing(name, *args, &block) ⇒ Object
- #target_class ⇒ Object
Constructor Details
#initialize(owner, name, options) ⇒ Proxy
Returns a new instance of Proxy.
17 18 19 20 21 22 |
# File 'lib/filemaker/model/relations/proxy.rb', line 17 def initialize(owner, name, ) @owner = owner @name = name = @class_name = .fetch(:class_name) { name.to_s.classify } end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
29 30 31 |
# File 'lib/filemaker/model/relations/proxy.rb', line 29 def method_missing(name, *args, &block) target.send(name, *args, &block) end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
12 13 14 |
# File 'lib/filemaker/model/relations/proxy.rb', line 12 def end |
#owner ⇒ Object
Returns the value of attribute owner.
12 13 14 |
# File 'lib/filemaker/model/relations/proxy.rb', line 12 def owner @owner end |
#target ⇒ Object
Returns the value of attribute target.
12 13 14 |
# File 'lib/filemaker/model/relations/proxy.rb', line 12 def target @target end |
Instance Method Details
#target_class ⇒ Object
24 25 26 27 |
# File 'lib/filemaker/model/relations/proxy.rb', line 24 def target_class return @class_name if @class_name.is_a?(Class) @class_name.constantize end |