Class: Sapphire::DSL::Evaluator

Inherits:
Object
  • Object
show all
Defined in:
lib/sapphire/DSL/Evaluators/Evaluator.rb

Instance Method Summary collapse

Constructor Details

#initialize(item, &block) ⇒ Evaluator

Returns a new instance of Evaluator.



4
5
6
7
# File 'lib/sapphire/DSL/Evaluators/Evaluator.rb', line 4

def initialize(item, &block)
  @item = item
  @block = block
end

Instance Method Details

#CompareWith(comparator) ⇒ Object



9
10
11
12
# File 'lib/sapphire/DSL/Evaluators/Evaluator.rb', line 9

def CompareWith(comparator)
  @comparator = comparator
  @item = comparator.Create(@item)
end

#executeObject



14
15
16
17
# File 'lib/sapphire/DSL/Evaluators/Evaluator.rb', line 14

def execute
  @comparator = EqualsComparison.new(@item) if @comparator == nil
  @block.call(@item, @comparator)
end