Class: Sapphire::DSL::Browser::Second

Inherits:
Object
  • Object
show all
Defined in:
lib/sapphire/DSL/Browser/Nouns/Second.rb

Instance Method Summary collapse

Constructor Details

#initialize(value, compare1, compare2) ⇒ Second

Returns a new instance of Second.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/sapphire/DSL/Browser/Nouns/Second.rb', line 13

def initialize(value, compare1, compare2)
  @value = value
  if(compare1.is_a?(String))
    @compare1 = Time.parse(compare1)
  else
    @compare1 = compare1
  end

  if(compare2.is_a?(String))
    @compare2 = Time.parse(compare2)
  else
    @compare2 = compare2
  end
end

Instance Method Details

#Differ(comparator) ⇒ Object



28
29
30
# File 'lib/sapphire/DSL/Browser/Nouns/Second.rb', line 28

def Differ(comparator)
  return Fix(DifferComparison.new(Evaluation.new((@compare2 - @compare1).to_i, @value)), comparator)
end

#Fix(evaluation, comparator) ⇒ Object



32
33
34
35
36
# File 'lib/sapphire/DSL/Browser/Nouns/Second.rb', line 32

def Fix(evaluation, comparator)
  comparator = comparator.Create(evaluation)

  comparator
end