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



1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
# File 'lib/when_exe/icalendar.rb', line 1502

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