Class: Storext::AttributeProxy
- Inherits:
-
Object
- Object
- Storext::AttributeProxy
- Defined in:
- lib/storext/attribute_proxy.rb
Instance Method Summary collapse
- #define_store_attribute ⇒ Object
-
#initialize(source_class, column, &block) ⇒ AttributeProxy
constructor
A new instance of AttributeProxy.
- #method_missing(method_name, *args, &block) ⇒ Object
Constructor Details
#initialize(source_class, column, &block) ⇒ AttributeProxy
Returns a new instance of AttributeProxy.
4 5 6 7 8 |
# File 'lib/storext/attribute_proxy.rb', line 4 def initialize(source_class, column, &block) @source_class = source_class @column = column @block = block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
14 15 16 |
# File 'lib/storext/attribute_proxy.rb', line 14 def method_missing(method_name, *args, &block) @source_class.store_attribute @column, method_name, *args end |
Instance Method Details
#define_store_attribute ⇒ Object
10 11 12 |
# File 'lib/storext/attribute_proxy.rb', line 10 def define_store_attribute instance_eval &@block end |