Class: Chronic::RepeaterDayName
- Defined in:
- lib/chronic/repeaters/repeater_day_name.rb
Overview
:nodoc:
Constant Summary collapse
- DAY_SECONDS =
(24 * 60 * 60)
86400
Instance Attribute Summary
Attributes inherited from Tag
Instance Method Summary collapse
Methods inherited from Repeater
#<=>, scan, scan_for_day_names, scan_for_day_portions, scan_for_month_names, scan_for_times, scan_for_units
Methods inherited from Tag
Constructor Details
This class inherits a constructor from Chronic::Tag
Instance Method Details
#next(pointer) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/chronic/repeaters/repeater_day_name.rb', line 4 def next(pointer) super direction = pointer == :future ? 1 : -1 if !@current_day_start @current_day_start = Time.local(@now.year, @now.month, @now.day) @current_day_start += direction * DAY_SECONDS day_num = symbol_to_number(@type) while @current_day_start.wday != day_num @current_day_start += direction * DAY_SECONDS end else @current_day_start += direction * 7 * DAY_SECONDS end Chronic::Span.new(@current_day_start, @current_day_start + DAY_SECONDS) end |
#this(pointer = :future) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/chronic/repeaters/repeater_day_name.rb', line 25 def this(pointer = :future) super pointer = :future if pointer == :none self.next(pointer) end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/chronic/repeaters/repeater_day_name.rb', line 36 def to_s super << '-dayofweek-' << @type.to_s end |
#width ⇒ Object
32 33 34 |
# File 'lib/chronic/repeaters/repeater_day_name.rb', line 32 def width DAY_SECONDS end |