Class: Boundy::Time::Comparator

Inherits:
Object
  • Object
show all
Includes:
Comparator
Defined in:
lib/boundy/time/comparator.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Comparator

included

Constructor Details

#initialize(bound, time) ⇒ Comparator

Returns a new instance of Comparator.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/boundy/time/comparator.rb', line 12

def initialize(bound, time)
  if bound.nil?
    raise
  end

  if time.nil?
    raise
  end
  other = Boundy::Bound.new(time)
  @comparator = Boundy::Bound::Comparator.new(bound, other) 
end

Class Method Details

.typesObject



6
7
8
# File 'lib/boundy/time/comparator.rb', line 6

def self.types
  [::Time, ActiveSupport::TimeWithZone]
end

Instance Method Details

#after?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/boundy/time/comparator.rb', line 24

def after?
  @comparator.after?
end

#before?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/boundy/time/comparator.rb', line 28

def before?
  @comparator.before?
end

#within?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/boundy/time/comparator.rb', line 32

def within?
  @comparator.within?
end