Class: IceCube::SingleOccurrenceRule

Inherits:
Rule
  • Object
show all
Defined in:
lib/ice_cube/single_occurrence_rule.rb

Instance Attribute Summary collapse

Attributes inherited from Rule

#uses

Instance Method Summary collapse

Methods inherited from Rule

#==, daily, from_hash, from_ical, from_yaml, #full_required?, #hash, hourly, minutely, monthly, #on?, #reset, secondly, #to_ical, #to_yaml, weekly, yearly

Constructor Details

#initialize(time) ⇒ SingleOccurrenceRule

Returns a new instance of SingleOccurrenceRule.



7
8
9
# File 'lib/ice_cube/single_occurrence_rule.rb', line 7

def initialize(time)
  @time = time
end

Instance Attribute Details

#timeObject (readonly)

Returns the value of attribute time.



5
6
7
# File 'lib/ice_cube/single_occurrence_rule.rb', line 5

def time
  @time
end

Instance Method Details

#next_time(t, schedule, closing_time) ⇒ Object



16
17
18
19
20
# File 'lib/ice_cube/single_occurrence_rule.rb', line 16

def next_time(t, schedule, closing_time)
  unless closing_time && closing_time < t
    time if time >= t
  end
end

#terminating?Boolean

Always terminating

Returns:

  • (Boolean)


12
13
14
# File 'lib/ice_cube/single_occurrence_rule.rb', line 12

def terminating?
  true
end

#to_hashObject



22
23
24
# File 'lib/ice_cube/single_occurrence_rule.rb', line 22

def to_hash
  { :time => time }
end