Module: CalendarHelper

Defined in:
lib/table_builder/calendar_helper.rb

Defined Under Namespace

Classes: Calendar, CalendarBuilder

Instance Method Summary collapse

Instance Method Details

#calendar_for(objects, *args) {|builder.new(objects || [], self, calendar, options)| ... } ⇒ Object

Yields:

  • (builder.new(objects || [], self, calendar, options))

Raises:

  • (ArgumentError)


3
4
5
6
7
8
9
10
11
12
# File 'lib/table_builder/calendar_helper.rb', line 3

def calendar_for(objects, *args)
  raise ArgumentError, "Missing block" unless block_given?
  options = args.last.is_a?(Hash) ? args.pop : {}
  html_options = options[:html]
  builder = options[:builder] || CalendarBuilder
  calendar = options[:calendar] || Calendar
  concat(tag(:table, html_options, true))
  yield builder.new(objects || [], self, calendar, options)
  concat('</table>')
end