Sha256: 008ff81f3c655996fc5f6d2155c7557fd33fd68b59060df4686970e1cd6cefea
Contents?: true
Size: 1020 Bytes
Versions: 5
Compression:
Stored size: 1020 Bytes
Contents
class Chronic::RepeaterMinute < Chronic::Repeater #:nodoc: MINUTE_SECONDS = 60 def next(pointer = :future) super direction = pointer == :future ? 1 : -1 raise 'not implemented' end def this(pointer = :future) super case pointer when :future minute_begin = @now minute_end = Time.local(@now.year, @now.month, @now.day, @now.hour, @now.min) when :past minute_begin = Time.local(@now.year, @now.month, @now.day, @now.hour, @now.min) minute_end = @now when :none minute_begin = Time.local(@now.year, @now.month, @now.day, @now.hour, @now.min) minute_end = Time.local(@now.year, @now.month, @now.day, @now.hour, @now.min) + MINUTE_SECONDS end Chronic::Span.new(minute_begin, minute_end) end def offset(span, amount, pointer) direction = pointer == :future ? 1 : -1 span + direction * amount * MINUTE_SECONDS end def width MINUTE_SECONDS end def to_s super << '-minute' end end
Version data entries
5 entries across 5 versions & 1 rubygems