class EventDb::EventCalendar

Public Class Methods

new( opts={} ) click to toggle source
# File lib/eventdb/calendar.rb, line 53
def initialize( opts={} )
  @events    = opts[:events] || Event.order('start_date DESC')   ## sort events by date (newest first)
end

Public Instance Methods

events() click to toggle source
# File lib/eventdb/calendar.rb, line 57
def events
  ## note: return new cursor  -- use decorator (instead of extra loop arg, why? why not?
  EventCursor.new( @events )
end
render( opts={} ) click to toggle source
# File lib/eventdb/calendar.rb, line 62
def render( opts={} )
  tmpl_path  = opts[:template] || './templates/CALENDAR.md.erb'
  tmpl       = File.open( tmpl_path, 'r:utf-8' ).read

  ERB.new( tmpl, nil, '<>' ).result( binding )   # <> omit newline for lines starting with <% and ending in %>
end