Class: BBAttributeFilters::Handlers::Proc
- Inherits:
-
Object
- Object
- BBAttributeFilters::Handlers::Proc
- Defined in:
- lib/bbattribute_filters/handlers/proc.rb
Overview
Handler which calls the proc within the scope of the evaluator
Instance Method Summary collapse
- #evaluate(evaluator) ⇒ Object
-
#initialize(proc) ⇒ Proc
constructor
A new instance of Proc.
Constructor Details
#initialize(proc) ⇒ Proc
Returns a new instance of Proc.
8 9 10 11 12 13 14 |
# File 'lib/bbattribute_filters/handlers/proc.rb', line 8 def initialize(proc) unless proc.is_a?(::Proc) raise ArgumentError, 'BBAttributeFilters::Handlers::EvaluationHandler - Expected a Proc' end @proc = proc end |
Instance Method Details
#evaluate(evaluator) ⇒ Object
16 17 18 |
# File 'lib/bbattribute_filters/handlers/proc.rb', line 16 def evaluate(evaluator) evaluator.instance_exec(&@proc) end |