Class: When::TM::Duration::Enumerator

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

Overview

Duration 用の 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 Parts::Enumerator

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

Constructor Details

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

Instance Method Details

#succWhen::TM::TemporalPosition

次の時間位置を取得する

Returns:



600
601
602
603
604
605
606
607
608
609
610
611
612
# File 'lib/when_exe/tmobjects.rb', line 600

def succ
  value    = @current
  @current = (@count_limit.kind_of?(Numeric) && @count >= @count_limit) ? nil :
             (@current==:first) ? @first :
             (@direction==:reverse) ? @first - @parent * @count : @first + @parent * @count
  if @last
    sign     = @parent.sign
    sign     = -sign if @direction==:reverse
    @current = nil if (sign * (@current <=> @last)) > 0
  end
  @count  += 1
  return value
end