Class: When::V::Event::Enumerator::Logic::Hour

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

Overview

BYHOURを実装

Direct Known Subclasses

Minute

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

Constructor Details

#initialize(by_part, list, lower = nil, upper = nil, leap = false) ⇒ Hour

Returns a new instance of Hour.



1722
1723
1724
1725
1726
1727
1728
1729
# File 'lib/when_exe/icalendar.rb', line 1722

def initialize(by_part, list, lower=nil, upper=nil, leap=false)
  super(by_part, list)
  if lower
    @list.each do |v|
      raise ArgumentError, "#{by_part} out of range: #{v}" unless lower <= v && v < upper
    end
  end
end

Instance Method Details

#_bound(seed, week_start) ⇒ Object



1714
1715
1716
1717
1718
1719
# File 'lib/when_exe/icalendar.rb', line 1714

def _bound(seed, week_start)
  return super unless @freq_index == When::WEEK
  lower_bound  = seed.floor(When::DAY, nil)
  higher_bound = lower_bound  + week_start.duration
  [lower_bound, higher_bound]
end