aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCarlos Goce <carlosgoce@gmail.com>2015-01-23 00:17:50 +0100
committerCarlos Goce <carlosgoce@gmail.com>2015-01-23 00:17:50 +0100
commit5390c1adeac5918d4529580776870eb1e729a30c (patch)
tree4f62e5bb1716127a482d04bd36229e2d936d0bba /lib
parent2d10c61b2f1d43fa98b46bdd17cfce86da95b7e5 (diff)
downloadpdf-calendars-5390c1adeac5918d4529580776870eb1e729a30c.tar.gz
pdf-calendars-5390c1adeac5918d4529580776870eb1e729a30c.tar.bz2
pdf-calendars-5390c1adeac5918d4529580776870eb1e729a30c.zip
Refactor calendar to hash
Diffstat (limited to 'lib')
-rw-r--r--lib/carlosgoce/calendar.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/carlosgoce/calendar.rb b/lib/carlosgoce/calendar.rb
index ea5bd6a..46b3bee 100644
--- a/lib/carlosgoce/calendar.rb
+++ b/lib/carlosgoce/calendar.rb
@@ -11,14 +11,14 @@ module CarlosGoce
end
def to_h
- h = {}
- (1..12).each do |month|
- month_name = I18n.t('date.month_names')[month].downcase
- month_days =(1...Time.days_in_month(month, @year)).to_a.each_slice(7).to_a
- h[month_name] = month_days
- end
+ Hash.new.tap {|bar|
+ (1..12).each do |month|
+ month_name = I18n.t('date.month_names')[month].downcase
+ month_days =(1...Time.days_in_month(month, @year)).to_a.each_slice(7).to_a
- h
+ bar[month_name] = month_days
+ end
+ }
end
end
end \ No newline at end of file