Class: CalendarNote::ShireWeek::Enumerator

Inherits:
When::CalendarTypes::CalendarNote::Enumerator show all
Defined in:
lib/when_exe/region/shire.rb

Overview

イベントを取得する Enumerator

Instance Attribute Summary

Attributes inherited from When::Parts::Enumerator

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

Instance Method Summary collapse

Methods inherited from When::CalendarTypes::CalendarNote::Enumerator

#_succ, #initialize

Methods inherited from When::Parts::Enumerator

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

Constructor Details

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

Instance Method Details

#succWhen::TM::TemporalPosition

次のイベントを得る


189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/when_exe/region/shire.rb', line 189

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.Duration('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