Class: When::Parts::Enumerator::Integrated

Inherits:
When::Parts::Enumerator show all
Defined in:
lib/when_exe/parts/enumerator.rb

Overview

複数の下位 Enumerator の結果を順に取り出す Enumerator

Instance Attribute Summary collapse

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::Parts::Enumerator

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

Constructor Details

#initialize(parent, enumerators, first, count_limit = nil) ⇒ Integrated

オブジェクトの生成

Parameters:

  • parent (Comparable)

    生成元

  • list (Array<When::Parts::Enumerator>)

    順に取り出す下位 Enumeratorの Array

  • first (When::TM::TemporalPosition)

    始点

  • direction (Symbol)
    :forward - 昇順
    :reverse - 降順
  • count_limit (Integer) (defaults to: nil)

    繰り返し回数(デフォルトは指定なし)

Raises:

  • (ArgumentError)

433
434
435
436
437
# File 'lib/when_exe/parts/enumerator.rb', line 433

def initialize(*args)
  parent, @enumerators, *rest = args
  raise ArgumentError, "Too few arguments" unless @enumerators.kind_of?(::Array)
  super(parent, *rest)
end

Instance Attribute Details

#enumeratorsArray<When::Parts::Enumerator>

下位 Enumerator


407
408
409
# File 'lib/when_exe/parts/enumerator.rb', line 407

def enumerators
  @enumerators
end

Instance Method Details

#rewindrewind された self

巻き戻す

Returns:


415
416
417
418
419
420
# File 'lib/when_exe/parts/enumerator.rb', line 415

def rewind
  @enumerators.each do |enum|
    enum._rewind
  end
  super
end