Class: When::CalendarNote::Week::Enumerator

Inherits:
Enumerator show all
Defined in:
lib/when_exe/calendarnote.rb

Overview

イベントを取得する Enumerator

Instance Attribute Summary

Attributes inherited from Parts::Enumerator

#count, #count_limit, #current, #direction, #exdate, #first, #index, #last, #object, #options, #parent, #processed

Instance Method Summary collapse

Methods inherited from Enumerator

#_succ, #initialize

Methods inherited from Parts::Enumerator

_options, #_rewind, #each, #exclude_end, #has_next?, #initialize, #next, #with_index, #with_object

Constructor Details

This class inherits a constructor from When::CalendarNote::Enumerator

Instance Method Details

#succWhen::TM::TemporalPosition

次のイベントを得る



837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
# File 'lib/when_exe/calendarnote.rb', line 837

def succ
  value = @current
  plus  = @delta.sign > 0
  if @current==:first
    @first   = event_eval(@first) unless plus
    @current = @first
  else
    if plus
      @current = event_eval(@current + @delta)
    else
      @last    = event_eval(@current - When::P1D)
      @current = event_eval(@current + @delta)
      unless [@current.to_i, value.to_i].include?(@last.to_i)
        @current = @last
        return value
      end
    end
    @current = event_eval(@current + @delta * 2) if @current.to_i == value.to_i
  end
  return value
end