Class: When::V::Event::Enumerator::Logic::Weekno

Inherits:
When::V::Event::Enumerator::Logic show all
Defined in:
lib/when_exe/icalendar.rb

Overview

BYWEEKNOを実装

Instance Attribute Summary

Attributes inherited from When::V::Event::Enumerator::Logic

#by_part, #cash, #freq_index, #list

Instance Method Summary collapse

Methods inherited from When::V::Event::Enumerator::Logic

#_candidates, #initialize

Constructor Details

This class inherits a constructor from When::V::Event::Enumerator::Logic

Instance Method Details

#_bound(seed, week_start) ⇒ Object


1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
# File 'lib/when_exe/icalendar.rb', line 1539

def _bound(seed, week_start)
  duration = week_start.duration
  center   = duration / 2
  # 1月4日を含む週
  return [seed.floor(When::YEAR, nil), seed.ceil(When::YEAR, nil)].map { |s|
    s += center
    bound  = s & week_start
    bound -= duration if (bound > s)
    bound
  }
end