Module: Hobix::EntryEnum

Defined in:
lib/hobix/entry.rb

Overview

common iteration of entries.

Instance Method Summary collapse

Instance Method Details

#each_day {|day.first.created, day| ... } ⇒ Object

Calls the block with two arguments: (1) a Time object with the earliest date of an issued post for that day; (2) an Array of entries posted that day, in chronological order.

Yields:

  • (day.first.created, day)


71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/hobix/entry.rb', line 71

def each_day
    last_day, day = nil, []
    each do |e|
        if last_day and last_day != e.day_id
            yield day.first.created, day
            day = []
        end
        last_day = e.day_id
        day << e
    end
    yield day.first.created, day if last_day
end