Class: IceCube::SingleOccurrenceRule
- Defined in:
- lib/ice_cube/single_occurrence_rule.rb
Constant Summary
Constants inherited from Rule
Instance Attribute Summary collapse
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Attributes inherited from Rule
Instance Method Summary collapse
- #full_required? ⇒ Boolean
-
#initialize(time) ⇒ SingleOccurrenceRule
constructor
A new instance of SingleOccurrenceRule.
- #next_time(t, _, closing_time) ⇒ Object
-
#terminating? ⇒ Boolean
Always terminating.
- #to_hash ⇒ Object
Methods inherited from Rule
#==, daily, from_hash, from_ical, from_yaml, #hash, hourly, minutely, monthly, #on?, #reset, secondly, #to_ical, #to_yaml, weekly, yearly
Constructor Details
#initialize(time) ⇒ SingleOccurrenceRule
Returns a new instance of SingleOccurrenceRule.
5 6 7 |
# File 'lib/ice_cube/single_occurrence_rule.rb', line 5 def initialize(time) @time = TimeUtil.ensure_time time end |
Instance Attribute Details
#time ⇒ Object (readonly)
Returns the value of attribute time.
3 4 5 |
# File 'lib/ice_cube/single_occurrence_rule.rb', line 3 def time @time end |
Instance Method Details
#full_required? ⇒ Boolean
24 25 26 |
# File 'lib/ice_cube/single_occurrence_rule.rb', line 24 def full_required? false end |
#next_time(t, _, closing_time) ⇒ Object
14 15 16 17 18 |
# File 'lib/ice_cube/single_occurrence_rule.rb', line 14 def next_time(t, _, closing_time) unless closing_time && closing_time < t time if time.to_i >= t.to_i end end |
#terminating? ⇒ Boolean
Always terminating
10 11 12 |
# File 'lib/ice_cube/single_occurrence_rule.rb', line 10 def terminating? true end |
#to_hash ⇒ Object
20 21 22 |
# File 'lib/ice_cube/single_occurrence_rule.rb', line 20 def to_hash {time: time} end |