From 47a55ef9ca277fcbce1ad1e908eb2110c2da57b4 Mon Sep 17 00:00:00 2001 From: Carlos Goce Date: Sat, 24 Jan 2015 20:14:56 +0100 Subject: Add formatted days spec --- lib/carlosgoce/calendar.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib') diff --git a/lib/carlosgoce/calendar.rb b/lib/carlosgoce/calendar.rb index 1166f55..6a5d8f6 100644 --- a/lib/carlosgoce/calendar.rb +++ b/lib/carlosgoce/calendar.rb @@ -27,6 +27,14 @@ module CarlosGoce } } end + + h[:formatted_days] = Array.new.tap {|a| + # todo Why I need to use 1? + 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]) + } } end -- cgit v1.2.3