calendario 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9291a462c911bf262155797e6e486d8732c9b5e71072e62786400f8fe2a9255c
4
- data.tar.gz: a97194dcf9e9a4d26e5cf8dd549980da27d614a5056eec1c3dec5f133c29b768
3
+ metadata.gz: 89a09aa1117a1ad2bac868c40efd513e14fb6de0fb7d5954956af9c2071b9c8d
4
+ data.tar.gz: 003dabc70ca610796204de8ec3efad4357ec75090b352b6c7a20d7e72476be73
5
5
  SHA512:
6
- metadata.gz: 7bd0eae6c396824afcb80847c5fce30fbf7f05b4cc209376c855450cd453b12234060ef0efb241122f4a738830696731a45da4d686852ad5c2b72150a8b5d49a
7
- data.tar.gz: 436d795f293c0ec6fdcc08218e9826a8d1f725ebb6dcae03b94963aded5dcff0d3c76e688a9d84641d6f4b0f0303b1fb0e843c9d24bb261bdfc562dce0d375e3
6
+ metadata.gz: 1fd1c4568c21d9278bdcadf849ab13bdd4b83cb5b9be5a84a741c6ab7e3097b71500a598758b4f7ca8e0f42d5d96c1692f7d534c49789b6dafd0dbd9320181cc
7
+ data.tar.gz: 8e23336cd1bbc7aef8317374464b7cb7e701ebcd4d5665911d36ae4bdc3391dd51e791e48713339963575da7780db6ddfae65b630e2ed123c10eae1ad2d21467
@@ -22,6 +22,8 @@ PreCommit:
22
22
 
23
23
  TrailingWhitespace:
24
24
  enabled: true
25
+ exclude:
26
+ - '**/*.snap'
25
27
 
26
28
  #PostCheckout:
27
29
  # ALL: # Special hook name that customizes all hooks of this type
@@ -4,9 +4,19 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.2.0] - 2020-06-29
8
+ ### Changed
9
+ - Split the year rendering into 4 classes: `YearRenderer`, `RenderedYear`, `MonthRenderer` and `RenderedMonth`
10
+ - Refactored the renderers to remove magic strings and numbers
11
+ - Refactored the renderers to create the basis for different column layouts
12
+
13
+ ### Fixed
14
+ - Fixed the usage documentation
15
+
7
16
  ## [0.1.0] - 2020-06-25
8
17
  ### Added
9
18
  - Initial core functionality
10
19
  - Codebase maintenance tools
11
20
 
21
+ [0.2.0]: https://github.com/wilsonsilva/tuga/compare/v0.1.0...v0.2.0
12
22
  [0.1.0]: https://github.com/wilsonsilva/tuga/compare/15adab8...v0.1.0
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # Calendario
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/caendario.svg)](https://badge.fury.io/rb/caendario)
4
- [![Build Status](https://travis-ci.org/wilsonsilva/caendario.svg?branch=master)](https://travis-ci.org/wilsonsilva/caendario)
5
- [![Maintainability](https://api.codeclimate.com/v1/badges/7afec90a09db3956b7dc/maintainability)](https://codeclimate.com/github/wilsonsilva/caendario/maintainability)
6
- [![Test Coverage](https://api.codeclimate.com/v1/badges/7afec90a09db3956b7dc/test_coverage)](https://codeclimate.com/github/wilsonsilva/caendario/test_coverage)
7
- [![Security](https://hakiri.io/github/wilsonsilva/caendario/master.svg)](https://hakiri.io/github/wilsonsilva/caendario/master)
8
- [![Inline docs](http://inch-ci.org/github/wilsonsilva/caendario.svg?branch=master)](http://inch-ci.org/github/wilsonsilva/caendario)
3
+ [![Gem Version](https://badge.fury.io/rb/calendario.svg)](https://badge.fury.io/rb/calendario)
4
+ [![Build Status](https://travis-ci.org/wilsonsilva/calendario.svg?branch=master)](https://travis-ci.org/wilsonsilva/calendario)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/98a431421f7754ffe8fc/maintainability)](https://codeclimate.com/github/wilsonsilva/calendario/maintainability)
6
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/98a431421f7754ffe8fc/test_coverage)](https://codeclimate.com/github/wilsonsilva/calendario/test_coverage)
7
+ [![Security](https://hakiri.io/github/wilsonsilva/calendario/master.svg)](https://hakiri.io/github/wilsonsilva/calendario/master)
8
+ [![Inline docs](http://inch-ci.org/github/wilsonsilva/calendario.svg?branch=master)](http://inch-ci.org/github/wilsonsilva/calendario)
9
9
 
10
10
  A cal-like calendar.
11
11
 
@@ -75,7 +75,7 @@ You can also customize what to display on each day. For example, this code wil d
75
75
  ```ruby
76
76
  calendar = Calendario::Calendar.new
77
77
  rendered_calendar = calendar.render_current_year do |date|
78
- if date.wday == 5 || if date.wday == 6
78
+ if date.wday == 5 || date.wday == 6
79
79
  'WE'
80
80
  else
81
81
  date.day.to_s.rjust(2)
@@ -39,7 +39,7 @@ module Calendario
39
39
  # end
40
40
  # end
41
41
  #
42
- # @return [String]
42
+ # @return [RenderedYear]
43
43
  #
44
44
  def render_current_year(&block)
45
45
  year = Year.new(Date.today.year)
@@ -36,7 +36,7 @@ module Calendario
36
36
  # @param [Integer] year_number The primitive numeric representation of a year
37
37
  # @param [Integer] month_number The month's number from 1 to 12
38
38
  #
39
- def initialize(year_number = 2020, month_number = 1)
39
+ def initialize(year_number, month_number)
40
40
  @year_number = year_number
41
41
  @month_number = month_number
42
42
  @days = (first_day..last_day).to_a
@@ -0,0 +1,75 @@
1
+ module Calendario
2
+ # A cal-like representation of a month:
3
+ #
4
+ # January
5
+ # Su Mo Tu We Th Fr Sa
6
+ # 1 2 3 4
7
+ # 5 6 7 8 9 10 11
8
+ # 12 13 14 15 16 17 18
9
+ # 19 20 21 22 23 24 25
10
+ # 26 27 28 29 30 31
11
+ #
12
+ class RenderedMonth
13
+ # A list of lines representing a month. The month name, the weekday initials and 4 to 5 lines of weeks
14
+ #
15
+ # @api private
16
+ # @return [Array<String>]
17
+ #
18
+ attr_reader :lines
19
+
20
+ # Initializes a rendered month
21
+ #
22
+ # @api private
23
+ # @param [Array<String>] lines List of lines representing a month. The month name, the weekday
24
+ # initials and 4 to 5 lines of weeks
25
+ #
26
+ def initialize(lines)
27
+ @lines = lines
28
+ end
29
+
30
+ # Returns the textual representation of a month
31
+ #
32
+ # @api private
33
+ # @return [String]
34
+ #
35
+ def to_s
36
+ lines.join("\n")
37
+ end
38
+
39
+ # The centered name of the month
40
+ #
41
+ # @api private
42
+ # @return [String]
43
+ #
44
+ def name
45
+ lines[0]
46
+ end
47
+
48
+ # The list of weekday initials (Su Mo Tu We Th Fr Sa)
49
+ #
50
+ # @api private
51
+ # @return [String]
52
+ #
53
+ def weekdays
54
+ lines[1]
55
+ end
56
+
57
+ # Returns 4 or 5 rows of weeks
58
+ #
59
+ # @api private
60
+ # @return [Array<String>]
61
+ #
62
+ def weeks
63
+ lines[2..-1]
64
+ end
65
+
66
+ # Finds one or more lines of the rendered month
67
+ #
68
+ # @api private
69
+ # @return [Array<String>]
70
+ #
71
+ def [](index)
72
+ lines.public_send(:[], index)
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,66 @@
1
+ module Calendario
2
+ # A cal-like representation of a year:
3
+ #
4
+ # 2020
5
+ # January February March
6
+ # Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
7
+ # 1 2 3 4 1 1 2 3 4 5 6 7
8
+ # 5 6 7 8 9 10 11 2 3 4 5 6 7 8 8 9 10 11 12 13 14
9
+ # 12 13 14 15 16 17 18 9 10 11 12 13 14 15 15 16 17 18 19 20 21
10
+ # 19 20 21 22 23 24 25 16 17 18 19 20 21 22 22 23 24 25 26 27 28
11
+ # 26 27 28 29 30 31 23 24 25 26 27 28 29 29 30 31
12
+ #
13
+ #
14
+ # April May June
15
+ # Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
16
+ # 1 2 3 4 1 2 1 2 3 4 5 6
17
+ # 5 6 7 8 9 10 11 3 4 5 6 7 8 9 7 8 9 10 11 12 13
18
+ # 12 13 14 15 16 17 18 10 11 12 13 14 15 16 14 15 16 17 18 19 20
19
+ # 19 20 21 22 23 24 25 17 18 19 20 21 22 23 21 22 23 24 25 26 27
20
+ # 26 27 28 29 30 24 25 26 27 28 29 30 28 29 30
21
+ # 31
22
+ #
23
+ # July August September
24
+ # Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
25
+ # 1 2 3 4 1 1 2 3 4 5
26
+ # 5 6 7 8 9 10 11 2 3 4 5 6 7 8 6 7 8 9 10 11 12
27
+ # 12 13 14 15 16 17 18 9 10 11 12 13 14 15 13 14 15 16 17 18 19
28
+ # 19 20 21 22 23 24 25 16 17 18 19 20 21 22 20 21 22 23 24 25 26
29
+ # 26 27 28 29 30 31 23 24 25 26 27 28 29 27 28 29 30
30
+ # 30 31
31
+ #
32
+ # October November December
33
+ # Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
34
+ # 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5
35
+ # 4 5 6 7 8 9 10 8 9 10 11 12 13 14 6 7 8 9 10 11 12
36
+ # 11 12 13 14 15 16 17 15 16 17 18 19 20 21 13 14 15 16 17 18 19
37
+ # 18 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26
38
+ # 25 26 27 28 29 30 31 29 30 27 28 29 30 31
39
+ #
40
+ class RenderedYear
41
+ # A list of lines representing a year
42
+ #
43
+ # @api private
44
+ # @return [Array<String>]
45
+ #
46
+ attr_reader :lines
47
+
48
+ # Initializes a rendered year
49
+ #
50
+ # @api private
51
+ # @param [Array<String>] lines List of lines representing a year
52
+ #
53
+ def initialize(lines)
54
+ @lines = lines
55
+ end
56
+
57
+ # Returns the textual representation of a year
58
+ #
59
+ # @api private
60
+ # @return [String]
61
+ #
62
+ def to_s
63
+ lines.join("\n")
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,120 @@
1
+ require 'calendario/month'
2
+ require 'calendario/rendered_month'
3
+
4
+ module Calendario
5
+ module Renderers
6
+ # Renders a month line by line
7
+ #
8
+ # @api private
9
+ #
10
+ class MonthRenderer
11
+ # The space of an empty day
12
+ # @return [String]
13
+ EMPTY_DAY_SPACES = ' '.freeze
14
+
15
+ # Initials of each week day
16
+ # @return [String]
17
+ WEEKDAY_INITIALS = 'Su Mo Tu We Th Fr Sa'.freeze
18
+
19
+ # Width of a rendered month
20
+ # @return [Integer]
21
+ MONTH_WIDTH = 20
22
+
23
+ # A proc to be executed on each date to define what is displayed on each day
24
+ #
25
+ # @api private
26
+ # @return [Proc]
27
+ #
28
+ attr_accessor :filter
29
+
30
+ # Initializes a month renderer
31
+ #
32
+ # @api private
33
+ #
34
+ def initialize
35
+ @filter = proc { |date| date.day.to_s.rjust(2) }
36
+ end
37
+
38
+ # Renders a month
39
+ #
40
+ # @api private
41
+ # @param [Month] month The month to be rendered
42
+ # @return [RenderedMonth]
43
+ #
44
+ def render(month)
45
+ weeks = build_weeks(month).map { |week| week.join(' ') }
46
+
47
+ lines = [
48
+ center_name(month),
49
+ WEEKDAY_INITIALS,
50
+ *weeks
51
+ ]
52
+
53
+ RenderedMonth.new(lines)
54
+ end
55
+
56
+ private
57
+
58
+ # Builds all weeks in a month, applying a filter on every date
59
+ #
60
+ # @api private
61
+ # @param [Month] month The month containing the weeks
62
+ # @return [Array<Date|String>]
63
+ #
64
+ def build_weeks(month)
65
+ weeks = month.weeks
66
+
67
+ add_leading_spaces(month.weeks.first)
68
+ add_trailing_spaces(month.weeks.last)
69
+
70
+ weeks << [EMPTY_DAY_SPACES] * 7 if month.weeks.size == 5
71
+ weeks.map do |week|
72
+ week.map(&method(:apply_filter))
73
+ end
74
+ end
75
+
76
+ # Applies a filter on a date or a blank space
77
+ #
78
+ # @api private
79
+ # @param [Date|String] date_or_string A date or a string to be parsed by a filter
80
+ # @return [Date|String]
81
+ #
82
+ def apply_filter(date_or_string)
83
+ date_or_string.is_a?(Date) ? filter.call(date_or_string) : date_or_string
84
+ end
85
+
86
+ # Prepends leading spaces in a week until the first day of the week is found
87
+ #
88
+ # @api private
89
+ # @param [Array<Date>] week A list of days in a week
90
+ # @return [void]
91
+ #
92
+ def add_leading_spaces(week)
93
+ first_day_is_sunday = week.first.wday.zero?
94
+ return if first_day_is_sunday
95
+
96
+ week.first.wday.times { week.unshift(EMPTY_DAY_SPACES) }
97
+ end
98
+
99
+ # Appends trailing spaces in a week until it has 7 items
100
+ #
101
+ # @api private
102
+ # @param [Array<Date>] week A list of days in a week
103
+ # @return [void]
104
+ #
105
+ def add_trailing_spaces(week)
106
+ (6 - week.last.wday).abs.times { week.push(EMPTY_DAY_SPACES) }
107
+ end
108
+
109
+ # Centers the month's name horizontally
110
+ #
111
+ # @api private
112
+ # @param [Month] month The month to be centered
113
+ # @return [String]
114
+ #
115
+ def center_name(month)
116
+ month.name.center(MONTH_WIDTH)
117
+ end
118
+ end
119
+ end
120
+ end
@@ -1,147 +1,83 @@
1
- require 'calendario/month'
1
+ require 'calendario/rendered_year'
2
+ require 'calendario/renderers/month_renderer'
2
3
 
3
4
  module Calendario
4
5
  module Renderers
5
- # Formats a year, line by line, in a table of 3 columns by 4 rows
6
+ # Renders a year, line by line, in a table of 3 columns by 4 rows
6
7
  class YearRenderer
7
- # The space of an empty day (3 = 2 digits + 1 space between digits)
8
- EMPTY_DAY_SPACES = ' ' * 3
8
+ # The space of an empty day
9
+ # @return [String]
10
+ EMPTY_DAY_SPACES = ' '.freeze
9
11
 
10
- # The space to add on the 6th row of a month when that row is empty
11
- EMPTY_WEEK_SPACES = ' ' * 20
12
+ # Number of month columns to display
13
+ # @return [Integer]
14
+ NUMBER_OF_MONTH_COLUMNS = 3
12
15
 
13
- # Formats a year, line by line, in a table of 3 columns by 4 rows like this:
14
- #
15
- # 2020 | Title, centered
16
- # January February March | Names of months, centered
17
- # Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa | Weekday initials
18
- # 1 2 3 4 1 1 2 3 4 5 6 7 | Rows of weeks
19
- # 5 6 7 8 9 10 11 2 3 4 5 6 7 8 8 9 10 11 12 13 14 |
20
- # 12 13 14 15 16 17 18 9 10 11 12 13 14 15 15 16 17 18 19 20 21 |
21
- # 19 20 21 22 23 24 25 16 17 18 19 20 21 22 22 23 24 25 26 27 28 |
22
- # 26 27 28 29 30 31 23 24 25 26 27 28 29 29 30 31 | Add spaces after the last day of the
23
- # | month until the first day of the week of
24
- # | the month of the following month on the
25
- # April May June | same row.
26
- # Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa |
27
- # 1 2 3 4 1 2 1 2 3 4 5 6 | Add spaces before the first day of the
28
- # 5 6 7 8 9 10 11 3 4 5 6 7 8 9 7 8 9 10 11 12 13 | month unless it is a Sunday.
29
- # 12 13 14 15 16 17 18 10 11 12 13 14 15 16 14 15 16 17 18 19 20 |
30
- # 19 20 21 22 23 24 25 17 18 19 20 21 22 23 21 22 23 24 25 26 27 |
31
- # 26 27 28 29 30 24 25 26 27 28 29 30 28 29 30 |
32
- # 31 | Add spaces before a day on the second
33
- # | or third month columns if the first or
34
- # July August September | second columns month are empty.
35
- # Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa |
36
- # 1 2 3 4 1 1 2 3 4 5 |
37
- # 5 6 7 8 9 10 11 2 3 4 5 6 7 8 6 7 8 9 10 11 12 |
38
- # 12 13 14 15 16 17 18 9 10 11 12 13 14 15 13 14 15 16 17 18 19 |
39
- # 19 20 21 22 23 24 25 16 17 18 19 20 21 22 20 21 22 23 24 25 26 |
40
- # 26 27 28 29 30 31 23 24 25 26 27 28 29 27 28 29 30 |
41
- # 30 31 |
42
- # |
43
- # October November December |
44
- # Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa |
45
- # 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5 |
46
- # 4 5 6 7 8 9 10 8 9 10 11 12 13 14 6 7 8 9 10 11 12 |
47
- # 11 12 13 14 15 16 17 15 16 17 18 19 20 21 13 14 15 16 17 18 19 |
48
- # 18 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26 |
49
- # 25 26 27 28 29 30 31 29 30 27 28 29 30 31 |
16
+ # Initializes a year renderer
50
17
  #
51
18
  # @api private
52
- # @param [Year] year The year to be formatted.
53
- # @return [String]
19
+ # @param [MonthRenderer] month_renderer A service to render a month line by line
54
20
  #
55
- def render(year)
56
- output = centered_year_line(year)
57
-
58
- # Display months in
59
- year.months.each_slice(3).with_index do |group_of_3_months, month_row|
60
- output << month_names_line(group_of_3_months)
61
- output << weekdays_initials_line
62
-
63
- # Display 6 rows of days. Each row is a week.
64
- 0.upto(5) do |week_number|
65
- # Display
66
- group_of_3_months.each_with_index do |month, index|
67
- # Correct the position for the first date of the first week
68
- output << EMPTY_DAY_SPACES * month.first_day.wday if week_number.zero?
69
-
70
- # Display a complete row of week days
71
- output << (month.weeks[week_number] || []).map do |date|
72
- if block_given?
73
- yield(date)
74
- else
75
- date.day.to_s.rjust(2)
76
- end
77
- end.join(' ') + ' '
78
-
79
- # Correct the position for the first date of the following month
80
- output << lead_space_after_last_day(month) if last_week_of_the_month?(month, week_number)
21
+ def initialize(month_renderer = MonthRenderer.new)
22
+ @month_renderer = month_renderer
23
+ end
81
24
 
82
- # Correct the position of the dates on empty rows (usually the last week)
83
- output << EMPTY_WEEK_SPACES if week_number == 5 && group_of_3_months[index - 1].weeks[week_number].nil?
84
- end
25
+ # Formats a year, line by line, in a table of 3 columns by 4 rows
26
+ #
27
+ # @api private
28
+ # @param [Year] year The year to be rendered.
29
+ # @return [RenderedYear]
30
+ #
31
+ def render(year, &block)
32
+ month_renderer.filter = block if block_given?
85
33
 
86
- # End of the week row. Start the next one on the next line
87
- output << "\n"
88
- end
34
+ lines = [center_year_number(year)]
35
+ rendered_months = render_months(year.months)
89
36
 
90
- # Separate rows of months
91
- output << "\n" if month_row < 3
37
+ rendered_months.each_slice(NUMBER_OF_MONTH_COLUMNS) do |months|
38
+ 0.upto(7) { |month_line| lines << take_row(month_line, months) }
39
+ lines.push('') # Separate rows of months
92
40
  end
93
41
 
94
- output
42
+ RenderedYear.new(lines)
95
43
  end
96
44
 
97
45
  private
98
46
 
99
- # Adds blank spaces to fill the empty week days on the last week row of the month
100
- #
101
- # @api private
102
- # @param [Month] month
103
- # @return [String]
104
- #
105
- def lead_space_after_last_day(month)
106
- EMPTY_DAY_SPACES * (6 - month.last_day.wday)
107
- end
108
-
109
- # Centers the year in the middle of the calendar
47
+ # A service to render a month line by line
110
48
  #
111
49
  # @api private
112
- # @param [Year] year The year to be displayed at the top of the calendar
113
- # @return [String]
50
+ # @return [Calendario::Renderers::MonthRenderer]
114
51
  #
115
- def centered_year_line(year)
116
- year.year_number.to_s.center(61) + "\n"
117
- end
52
+ attr_accessor :month_renderer
118
53
 
119
- # Displays 3 columns of month names in a line
54
+ # Extracts a row from a group of months
120
55
  #
121
56
  # @api private
122
- # @param [Array<Month>] group_of_3_months The list of months whose names will be displayed
123
- # @return [String]
57
+ # @return [Array<String>]
124
58
  #
125
- def month_names_line(group_of_3_months)
126
- group_of_3_months.map { |month| month.name.center(20) }.join(' ') + " \n"
59
+ def take_row(month_line, months)
60
+ months.map { |month| month[month_line] }.join(EMPTY_DAY_SPACES)
127
61
  end
128
62
 
129
- # Displays 3 columns of weekdays initials in a line
63
+ # Centers the year in the middle of the calendar
130
64
  #
131
65
  # @api private
66
+ # @param [Year] year The year to be displayed at the top of the calendar
132
67
  # @return [String]
133
68
  #
134
- def weekdays_initials_line
135
- "Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa \n"
69
+ def center_year_number(year)
70
+ year.year_number.to_s.center(61)
136
71
  end
137
72
 
138
- # Whether the week is the last week of the month
73
+ # Renders a list of months
139
74
  #
140
75
  # @api private
141
- # @return [Boolean]
76
+ # @param [Array<Month>] months The list of months to be rendered
77
+ # @return [Array<RenderedMonth>]
142
78
  #
143
- def last_week_of_the_month?(month, week_number)
144
- month.weeks[week_number] == month.weeks.last
79
+ def render_months(months)
80
+ months.map { |month| month_renderer.render(month) }
145
81
  end
146
82
  end
147
83
  end
@@ -1,3 +1,3 @@
1
1
  module Calendario
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calendario
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wilson Silva
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-25 00:00:00.000000000 Z
11
+ date: 2020-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler-audit
@@ -291,6 +291,9 @@ files:
291
291
  - lib/calendario.rb
292
292
  - lib/calendario/calendar.rb
293
293
  - lib/calendario/month.rb
294
+ - lib/calendario/rendered_month.rb
295
+ - lib/calendario/rendered_year.rb
296
+ - lib/calendario/renderers/month_renderer.rb
294
297
  - lib/calendario/renderers/year_renderer.rb
295
298
  - lib/calendario/version.rb
296
299
  - lib/calendario/year.rb