From 033cfbe2134f8798fb9f2836229e68689ad918cc Mon Sep 17 00:00:00 2001 From: Carlos Goce Date: Sat, 24 Jan 2015 22:43:21 +0100 Subject: Add formatted days to data structure --- lib/carlosgoce/calendar.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/carlosgoce') diff --git a/lib/carlosgoce/calendar.rb b/lib/carlosgoce/calendar.rb index 1379e48..48f0071 100644 --- a/lib/carlosgoce/calendar.rb +++ b/lib/carlosgoce/calendar.rb @@ -28,12 +28,10 @@ module CarlosGoce } } - h[month][:formatted_days] = Array.new.tap {|a| - days_before_week_start = Date.new(@year, 1, h[1][:days].first).wday - empty_days = [''] * (days_before_week_start - 1) - - a << (empty_days + h[1][:days]) - } + # Formatted days creation + days_before_week_start = Date.new(@year, 1, h[1][:days].first).wday + empty_days = [''] * (days_before_week_start - 1) + h[month][:formatted_days] = empty_days + h[1][:days] end end } -- cgit v1.2.3