Class: CalendariumRomanum::Util::DateEnumerator Abstract

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/calendarium-romanum/util.rb

Overview

This class is abstract.

Abstract superclass for date enumerators.

Direct Known Subclasses

Month, Year

Instance Method Summary collapse

Instance Method Details

#each {|Date| ... } ⇒ void, Enumerator Also known as: each_day

Yields:

  • (Date)

Returns:

  • (void, Enumerator)

14
15
16
17
18
19
20
21
22
# File 'lib/calendarium-romanum/util.rb', line 14

def each
  return to_enum(__method__) unless block_given?

  d = @start
  begin
    yield d
    d = d.succ
  end until enumeration_over? d
end

#enumeration_over?(date) ⇒ Boolean

Parameters:

  • date (Date)

Returns:

  • (Boolean)

26
27
28
# File 'lib/calendarium-romanum/util.rb', line 26

def enumeration_over?(date)
  @start.send(@prop) != date.send(@prop)
end