class EventDb::EventCursor::State

Public Class Methods

new() click to toggle source
# File lib/eventdb/calendar.rb, line 18
def initialize
  @last_date  = Date.new( 1971, 1, 1 )
  @new_date   = true
  @new_year   = true
  @new_month  = true
end

Public Instance Methods

new_date?() click to toggle source
# File lib/eventdb/calendar.rb, line 24
def new_date?()  @new_date; end
new_month?() click to toggle source
# File lib/eventdb/calendar.rb, line 26
def new_month?() @new_month; end
new_year?() click to toggle source
# File lib/eventdb/calendar.rb, line 25
def new_year?()  @new_year; end
next( event ) click to toggle source
# File lib/eventdb/calendar.rb, line 28
def next( event )
  if @last_date.year  == event.start_date.year &&
     @last_date.month == event.start_date.month
       @new_date  = false
       @new_year  = false
       @new_month = false
  else
    @new_date = true
    ## new year?
    @new_year  = @last_date.year != event.start_date.year ? true : false
    ## new_month ?
    @new_month = (@new_year == true || @last_date.month != event.start_date.month) ? true : false
  end
  @last_date = event.start_date
end