aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Goce <carlosgoce@gmail.com>2015-01-23 18:14:25 +0100
committerCarlos Goce <carlosgoce@gmail.com>2015-01-23 18:14:25 +0100
commit621eb6150b6d92def2d2bae4968bbe4f35b0a754 (patch)
tree019c5079f56859cbcb798d3f5d9fb688e030d43f
parente1a70c37b11cb893a126784cc3d94b01f7c6c041 (diff)
downloadpdf-calendars-621eb6150b6d92def2d2bae4968bbe4f35b0a754.tar.gz
pdf-calendars-621eb6150b6d92def2d2bae4968bbe4f35b0a754.tar.bz2
pdf-calendars-621eb6150b6d92def2d2bae4968bbe4f35b0a754.zip
Refactor data structure generation
-rw-r--r--lib/carlosgoce/calendar.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/carlosgoce/calendar.rb b/lib/carlosgoce/calendar.rb
index 74051d3..28ed542 100644
--- a/lib/carlosgoce/calendar.rb
+++ b/lib/carlosgoce/calendar.rb
@@ -13,9 +13,10 @@ module CarlosGoce
def to_h
Hash.new.tap {|h|
(1..12).each do |month|
- h[month] = {}
- h[month][:days] = (1...Time.days_in_month(month, @year)).to_a.each_slice(7).to_a
- h[month][:name] = I18n.t('date.month_names')[month].downcase
+ h[month] = Hash.new.tap {|m|
+ m[:days] = (1...Time.days_in_month(month, @year)).to_a.each_slice(7).to_a
+ m[:name] = I18n.t('date.month_names')[month].downcase
+ }
end
}
end