test/app/vendor/gems/chronic-0.2.2/lib/chronic/repeaters/repeater_time.rb
def next(pointer)
    super
    
    half_day = 60 * 60 * 12
    full_day = 60 * 60 * 24
    
    first = false
    
    unless @current_time
      first = true
      midnight = Time.local(@now.year, @now.month, @now.day)
      yesterday_midnight = midnight - full_day
      tomorrow_midnight = midnight + full_day

      catch :done do
        if pointer == :future
          if @type.ambiguous?
            [midnight + @type, midnight + half_day + @type, tomorrow_midnight + @type].each do |t|
              (@current_time = t; throw :done) if t > @now
            end
          else
            [midnight + @type, tomorrow_midnight + @type].each do |t|
              (@current_time = t; throw :done) if t > @now
            end
          end
        else # pointer == :past
          if @type.ambiguous?
            [midnight + half_day + @type, midnight + @type, yesterday_midnight + @type * 2].each do |t|
              (@current_time = t; throw :done) if t < @now
            end
          else
            [midnight + @type, yesterday_midnight + @type].each do |t|
              (@current_time = t; throw :done) if t < @now
            end
          end
        end
      end
      
      @current_time || raise("Current time cannot be nil at this point")
    end
    
    unless first
      increment = @type.ambiguous? ? half_day : full_day
      @current_time += pointer == :future ? increment : -increment
    end
    
    Chronic::Span.new(@current_time, @current_time + width)
  end
# Return the next past or future Span for the time that this Repeater represents
#   pointer - Symbol representing which temporal direction to fetch the next day
#             must be either :past or :future
Return the next past or future Span for the time that this Repeater represents
pointer - Symbol representing which temporal direction to fetch the next day
must be either :past or :future
Return the next past or future Span for the time that this Repeater represents pointer - Symbol representing which temporal direction to fetch the next day must be either : past or : future
def next(pointer)
    super
    half_day = 60 * 60 * 12
    full_day = 60 * 60 * 24
    first = false
    unless @current_time
      first = true
      midnight = Time.local(@now.year, @now.month, @now.day)
      yesterday_midnight = midnight - full_day
      tomorrow_midnight = midnight + full_day
      catch :done do
        if pointer == :future
          if @type.ambiguous?
            [midnight + @type, midnight + half_day + @type, tomorrow_midnight + @type].each do |t|
              (@current_time = t; throw :done) if t > @now
            end
          else
            [midnight + @type, tomorrow_midnight + @type].each do |t|
              (@current_time = t; throw :done) if t > @now
            end
          end
        else 
          if @type.ambiguous?
            [midnight + half_day + @type, midnight + @type, yesterday_midnight + @type * 2].each do |t|
              (@current_time = t; throw :done) if t < @now
            end
          else
            [midnight + @type, yesterday_midnight + @type].each do |t|
              (@current_time = t; throw :done) if t < @now
            end
          end
        end
      end
      @current_time || raise("Current time cannot be nil at this point")
    end
    unless first
      increment = @type.ambiguous? ? half_day : full_day
      @current_time += pointer == :future ? increment : -increment
    end
    Chronic::Span.new(@current_time, @current_time + width)
  end
def next ( pointer ) super half_day = 60 * 60 * 12 full_day = 60 * 60 * 24 first = false unless @current_time first = true midnight = Time . local ( @now . year , @now . month , @now . day ) yesterday_midnight = midnight - full_day tomorrow_midnight = midnight + full_day catch :done do if pointer == :future if @type . ambiguous? [ midnight + @type , midnight + half_day + @type , tomorrow_midnight + @type ] . each do | t | ( @current_time = t ; throw :done ) if t > @now end else [ midnight + @type , tomorrow_midnight + @type ] . each do | t | ( @current_time = t ; throw :done ) if t > @now end end else if @type . ambiguous? [ midnight + half_day + @type , midnight + @type , yesterday_midnight + @type * 2 ] . each do | t | ( @current_time = t ; throw :done ) if t < @now end else [ midnight + @type , yesterday_midnight + @type ] . each do | t | ( @current_time = t ; throw :done ) if t < @now end end end end @current_time || raise ( "Current time cannot be nil at this point" ) end unless first increment = @type . ambiguous? ? half_day : full_day @current_time += pointer == :future ? increment : - increment end Chronic :: Span . new ( @current_time , @current_time + width ) end
Return the next past or future Span for the time that this Repeater represents
pointer - Symbol representing which temporal direction to fetch the next day
must be either :past or :future
Return the next past or future Span for the time that this Repeater represents pointer - Symbol representing which temporal direction to fetch the next day must be either : past or : future
# pointer == :past
pointer