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