Class: Blackcal::DayRange
- Inherits:
-
Object
- Object
- Blackcal::DayRange
- Includes:
- Enumerable
- Defined in:
- lib/blackcal/range/day_range.rb
Overview
Day range
Instance Attribute Summary collapse
-
#numbers ⇒ Array<Integer>
(also: #to_a)
readonly
Numbers in range.
Instance Method Summary collapse
-
#cover?(timestamp) ⇒ Boolean
Returns true if it covers timestamp.
-
#each(&block) ⇒ Object
Iterate over range.
-
#initialize(numbers) ⇒ DayRange
constructor
Initialize numbers range.
Constructor Details
Instance Attribute Details
#numbers ⇒ Array<Integer> (readonly) Also known as: to_a
Returns numbers in range.
11 12 13 |
# File 'lib/blackcal/range/day_range.rb', line 11 def numbers @numbers end |
Instance Method Details
#cover?(timestamp) ⇒ Boolean
Returns true if it covers timestamp
27 28 29 30 31 |
# File 'lib/blackcal/range/day_range.rb', line 27 def cover?() return false if numbers.nil? || numbers.empty? numbers.include?(.day) end |
#each(&block) ⇒ Object
Iterate over range
38 39 40 |
# File 'lib/blackcal/range/day_range.rb', line 38 def each(&block) to_a.each(&block) end |