Class: BatchAgg::AttrMagic
- Inherits:
-
Object
- Object
- BatchAgg::AttrMagic
- Defined in:
- lib/batchagg.rb
Instance Method Summary collapse
-
#initialize(model, outer_table) ⇒ AttrMagic
constructor
A new instance of AttrMagic.
- #method_missing(name, *args) ⇒ Object
- #respond_to_missing?(name) ⇒ Boolean
Constructor Details
#initialize(model, outer_table) ⇒ AttrMagic
Returns a new instance of AttrMagic.
59 60 61 62 |
# File 'lib/batchagg.rb', line 59 def initialize(model, outer_table) @model = model @outer_table = outer_table end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/batchagg.rb', line 64 def method_missing(name, *args, &) if @model.columns_hash.key?(name.to_s) @outer_table[name] else super end end |
Instance Method Details
#respond_to_missing?(name) ⇒ Boolean
72 73 74 |
# File 'lib/batchagg.rb', line 72 def respond_to_missing?(name, *) @model.columns_hash.key?(name.to_s) || super end |