Class: Calendario::RenderedMonth
- Inherits:
-
Object
- Object
- Calendario::RenderedMonth
- Defined in:
- lib/calendario/rendered_month.rb
Overview
A cal-like representation of a month:
January
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Instance Attribute Summary collapse
-
#lines ⇒ Array<String>
readonly
private
A list of lines representing a month.
Instance Method Summary collapse
-
#[](index) ⇒ Array<String>
private
Finds one or more lines of the rendered month.
-
#initialize(lines) ⇒ RenderedMonth
constructor
private
Initializes a rendered month.
-
#name ⇒ String
private
The centered name of the month.
-
#to_s ⇒ String
private
Returns the textual representation of a month.
-
#weekdays ⇒ String
private
The list of weekday initials (Su Mo Tu We Th Fr Sa).
-
#weeks ⇒ Array<String>
private
Returns 4 or 5 rows of weeks.
Constructor Details
#initialize(lines) ⇒ RenderedMonth
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.
Initializes a rendered month
initials and 4 to 5 lines of weeks
26 27 28 |
# File 'lib/calendario/rendered_month.rb', line 26 def initialize(lines) @lines = lines end |
Instance Attribute Details
#lines ⇒ Array<String> (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.
A list of lines representing a month. The month name, the weekday initials and 4 to 5 lines of weeks
18 19 20 |
# File 'lib/calendario/rendered_month.rb', line 18 def lines @lines end |
Instance Method Details
#[](index) ⇒ Array<String>
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.
Finds one or more lines of the rendered month
71 72 73 |
# File 'lib/calendario/rendered_month.rb', line 71 def [](index) lines.public_send(:[], index) end |
#name ⇒ String
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.
The centered name of the month
44 45 46 |
# File 'lib/calendario/rendered_month.rb', line 44 def name lines[0] end |
#to_s ⇒ String
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.
Returns the textual representation of a month
35 36 37 |
# File 'lib/calendario/rendered_month.rb', line 35 def to_s lines.join("\n") end |
#weekdays ⇒ String
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.
The list of weekday initials (Su Mo Tu We Th Fr Sa)
53 54 55 |
# File 'lib/calendario/rendered_month.rb', line 53 def weekdays lines[1] end |
#weeks ⇒ Array<String>
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.
Returns 4 or 5 rows of weeks
62 63 64 |
# File 'lib/calendario/rendered_month.rb', line 62 def weeks lines[2..-1] end |