class Meetupinator::TemplateContext
Object passed to templates during formatting.
Constants
- DAY
Attributes
events[R]
Public Class Methods
new(events)
click to toggle source
# File lib/meetupinator/template_context.rb, line 8 def initialize(events) @events = events end
Public Instance Methods
add_days(date, n)
click to toggle source
FIXME: This will probably break for daylight savings
# File lib/meetupinator/template_context.rb, line 31 def add_days(date, n) date + n * DAY end
days_list(start_date, n)
click to toggle source
# File lib/meetupinator/template_context.rb, line 22 def days_list(start_date, n) (0..(n - 1)).map { |d| add_days(start_date, d) } end
get_start_of_week(d)
click to toggle source
FIXME: This will probably break for daylight savings
# File lib/meetupinator/template_context.rb, line 13 def get_start_of_week(d) d -= DAY until d.monday? d end
sorted_events()
click to toggle source
# File lib/meetupinator/template_context.rb, line 18 def sorted_events events.sort { |a, b| a[:start_time] <=> b[:start_time] } end
template_binding()
click to toggle source
# File lib/meetupinator/template_context.rb, line 26 def template_binding binding end