Class: BBAttributeFilters::Handlers::Block

Inherits:
Object
  • Object
show all
Defined in:
lib/bbattribute_filters/handlers/block.rb

Overview

Handler which calls the block within the scope of the evaluator

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Block

Returns a new instance of Block.

Raises:

  • (ArgumentError)


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