Class: ConditionalCounterCache::Reflection::Condition
- Inherits:
-
Object
- Object
- ConditionalCounterCache::Reflection::Condition
- Defined in:
- lib/conditional_counter_cache/reflection.rb
Overview
Utility wrapper of ‘option[:condition]`.
Instance Method Summary collapse
- #call(record) ⇒ Object
-
#initialize(value) ⇒ Condition
constructor
A new instance of Condition.
Constructor Details
#initialize(value) ⇒ Condition
Returns a new instance of Condition.
17 18 19 |
# File 'lib/conditional_counter_cache/reflection.rb', line 17 def initialize(value) @value = value end |
Instance Method Details
#call(record) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/conditional_counter_cache/reflection.rb', line 21 def call(record) case @value when Proc record.instance_exec(&@value) when nil true else record.send(@value) end end |