Sha256: 0857f4eba920a59bd7446978ebd676d1ae4e3ec8299827c65d0d768c29a22d31
Contents?: true
Size: 773 Bytes
Versions: 2
Compression:
Stored size: 773 Bytes
Contents
class Chronic::RepeaterSecond < Chronic::Repeater #:nodoc: SECOND_SECONDS = 1 # haha, awesome def initialize(type) super @second_start = nil end def next(pointer = :future) super direction = pointer == :future ? 1 : -1 if !@second_start @second_start = @now + (direction * SECOND_SECONDS) else @second_start += SECOND_SECONDS * direction end Chronic::Span.new(@second_start, @second_start + SECOND_SECONDS) end def this(pointer = :future) super Chronic::Span.new(@now, @now + 1) end def offset(span, amount, pointer) direction = pointer == :future ? 1 : -1 span + direction * amount * SECOND_SECONDS end def width SECOND_SECONDS end def to_s super << '-second' end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
slaxor-chronic-0.3.1 | lib/chronic/repeaters/repeater_second.rb |
chronic-0.3.0 | lib/chronic/repeaters/repeater_second.rb |