Class: Availability::Exclusion::Rule::BeforeTime

Inherits:
InstanceVariableComparability show all
Defined in:
lib/availability/exclusion.rb

Instance Method Summary collapse

Methods inherited from InstanceVariableComparability

#<=>

Constructor Details

#initialize(date_or_time) ⇒ BeforeTime

Returns a new instance of BeforeTime.



115
116
117
# File 'lib/availability/exclusion.rb', line 115

def initialize(date_or_time)
  @compare_to = date_or_time.to_time
end

Instance Method Details

#violated_by?(time) ⇒ Boolean

Returns:

  • (Boolean)


119
120
121
# File 'lib/availability/exclusion.rb', line 119

def violated_by?(time)
  time.to_time.seconds_since_midnight < @compare_to.to_time.seconds_since_midnight
end