1 class Chronic::RepeaterHour < Chronic::Repeater #:nodoc:
2 HOUR_SECONDS = 3600 # 60 * 60
7 if !@current_hour_start
10 @current_hour_start = Time.construct(@now.year, @now.month, @now.day, @now.hour + 1)
12 @current_hour_start = Time.construct(@now.year, @now.month, @now.day, @now.hour - 1)
15 direction = pointer == :future ? 1 : -1
16 @current_hour_start += direction * HOUR_SECONDS
19 Chronic::Span.new(@current_hour_start, @current_hour_start + HOUR_SECONDS)
22 def this(pointer = :future)
27 hour_start = Time.construct(@now.year, @now.month, @now.day, @now.hour, @now.min + 1)
28 hour_end = Time.construct(@now.year, @now.month, @now.day, @now.hour + 1)
30 hour_start = Time.construct(@now.year, @now.month, @now.day, @now.hour)
31 hour_end = Time.construct(@now.year, @now.month, @now.day, @now.hour, @now.min)
33 hour_start = Time.construct(@now.year, @now.month, @now.day, @now.hour)
34 hour_end = hour_begin + HOUR_SECONDS
37 Chronic::Span.new(hour_start, hour_end)
40 def offset(span, amount, pointer)
41 direction = pointer == :future ? 1 : -1
42 span + direction * amount * HOUR_SECONDS