Class: Proc::Conditions
- Inherits:
-
BlankSlate
- Object
- BlankSlate
- Proc::Conditions
- Defined in:
- lib/data_mapper/support/proc.rb
Defined Under Namespace
Classes: Attribute
Instance Method Summary collapse
- #__to_hash__ ⇒ Object
-
#initialize(&block) ⇒ Conditions
constructor
A new instance of Conditions.
- #method_missing(sym, *args) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Conditions
Returns a new instance of Conditions.
12 13 14 15 |
# File 'lib/data_mapper/support/proc.rb', line 12 def initialize(&block) @block = block @conditions = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Method Details
#__to_hash__ ⇒ Object
23 24 25 26 27 28 |
# File 'lib/data_mapper/support/proc.rb', line 23 def __to_hash__ instance_eval(&@block) @conditions.inject({}) do |h,attribute| h[attribute.__operator__] = *attribute.__args__; h end end |