Method: When::Coordinates::Residue::Enumerator#initialize
- Defined in:
- lib/when_exe/coordinates.rb
#initialize(parent, range, count_limit = nil) ⇒ Enumerator #initialize(parent, first, direction, count_limit) ⇒ Enumerator
オブジェクトの生成
618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 |
# File 'lib/when_exe/coordinates.rb', line 618 def initialize(*args) case args[1] when When::TimeValue first = args[1] & args[0] first = args[1] & (args[0] << 1) if args[2] == :reverse && first > args[1] args[1] = first when Range first = args[1].first & args[0] args[1] = (args[1].exclude_end?) ? (first...args[1].last) : (first..args[1].last) else raise TypeError, "Second Argument should be 'When::TM::(Temporal)Position'" end @period = When::TM::PeriodDuration.new(args[0].divisor, When::Coordinates::PRECISION[args[0].units] || When::DAY) super(*args) end |