class Calendario::RenderedMonth

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

Attributes

lines[R]

A list of lines representing a month. The month name, the weekday initials and 4 to 5 lines of weeks

@api private @return [Array<String>]

Public Class Methods

new(lines) click to toggle source

Initializes a rendered month

@api private @param [Array<String>] lines List of lines representing a month. The month name, the weekday initials and 4 to 5 lines of weeks

# File lib/calendario/rendered_month.rb, line 26
def initialize(lines)
  @lines = lines
end

Public Instance Methods

[](index) click to toggle source

Finds one or more lines of the rendered month

@api private @return [Array<String>]

# File lib/calendario/rendered_month.rb, line 71
def [](index)
  lines.public_send(:[], index)
end
name() click to toggle source

The centered name of the month

@api private @return [String]

# File lib/calendario/rendered_month.rb, line 44
def name
  lines[0]
end
to_s() click to toggle source

Returns the textual representation of a month

@api private @return [String]

# File lib/calendario/rendered_month.rb, line 35
def to_s
  lines.join("\n")
end
weekdays() click to toggle source

The list of weekday initials (Su Mo Tu We Th Fr Sa)

@api private @return [String]

# File lib/calendario/rendered_month.rb, line 53
def weekdays
  lines[1]
end
weeks() click to toggle source

Returns 4 or 5 rows of weeks

@api private @return [Array<String>]

# File lib/calendario/rendered_month.rb, line 62
def weeks
  lines[2..-1]
end