Class: Calendrier::CalendrierBuilder::Builder
- Inherits:
-
Object
- Object
- Calendrier::CalendrierBuilder::Builder
- Defined in:
- lib/calendrier/calendrier_builder.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(context, options = {}) ⇒ Builder
constructor
A new instance of Builder.
- #render(&block) ⇒ Object
Constructor Details
#initialize(context, options = {}) ⇒ Builder
Returns a new instance of Builder.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/calendrier/calendrier_builder.rb', line 5 def initialize(context, = {}) @context, = context, [:display] ||= :month unless .include? :title month = [:month] || nil year = [:year] || nil date = (month.nil? || year.nil?) ? Time.now.to_date : Date.new(year, month) [:title] = "#{I18n.l(date)}" end end |
Instance Method Details
#render(&block) ⇒ Object
17 18 19 |
# File 'lib/calendrier/calendrier_builder.rb', line 17 def render(&block) raise NotImplementedError end |