From e1a70c37b11cb893a126784cc3d94b01f7c6c041 Mon Sep 17 00:00:00 2001 From: Carlos Goce Date: Fri, 23 Jan 2015 18:13:02 +0100 Subject: Refactor data structure --- lib/carlosgoce/calendar.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/carlosgoce/calendar.rb') diff --git a/lib/carlosgoce/calendar.rb b/lib/carlosgoce/calendar.rb index 5ac27b0..74051d3 100644 --- a/lib/carlosgoce/calendar.rb +++ b/lib/carlosgoce/calendar.rb @@ -11,12 +11,11 @@ module CarlosGoce end def to_h - Hash.new.tap {|bar| + Hash.new.tap {|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 - - bar[month_name] = month_days + 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 end } end -- cgit v1.2.3