Class: Calendario::Calendar
- Inherits:
-
Object
- Object
- Calendario::Calendar
- Defined in:
- lib/calendario/calendar.rb
Overview
A time period to be rendered
Instance Attribute Summary collapse
-
#year_renderer ⇒ Calendario::Renderers::YearRenderer
readonly
private
Formats a year, line by line, in a table of 3 columns by 4 rows.
Instance Method Summary collapse
-
#initialize(year_renderer = Renderers::YearRenderer.new) ⇒ Calendar
constructor
private
Initialize a calendar.
-
#render_current_year(&block) ⇒ RenderedYear
Renders the current year as a string.
Constructor Details
#initialize(year_renderer = Renderers::YearRenderer.new) ⇒ Calendar
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a calendar
table of 3 columns by 4 rows
20 21 22 |
# File 'lib/calendario/calendar.rb', line 20 def initialize(year_renderer = Renderers::YearRenderer.new) @year_renderer = year_renderer end |
Instance Attribute Details
#year_renderer ⇒ Calendario::Renderers::YearRenderer (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Formats a year, line by line, in a table of 3 columns by 4 rows
12 13 14 |
# File 'lib/calendario/calendar.rb', line 12 def year_renderer @year_renderer end |
Instance Method Details
#render_current_year(&block) ⇒ RenderedYear
Renders the current year as a string
44 45 46 47 |
# File 'lib/calendario/calendar.rb', line 44 def render_current_year(&block) year = Year.new(Date.today.year) year_renderer.render(year, &block) end |