aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Goce <carlosgoce@gmail.com>2015-01-24 22:43:21 +0100
committerCarlos Goce <carlosgoce@gmail.com>2015-01-24 22:43:21 +0100
commit033cfbe2134f8798fb9f2836229e68689ad918cc (patch)
tree3990090c41c25fe0b2418ef7e91623be387716a7
parentc23e146e3b9901505472c4f33d30883a7ae5440c (diff)
downloadpdf-calendars-033cfbe2134f8798fb9f2836229e68689ad918cc.tar.gz
pdf-calendars-033cfbe2134f8798fb9f2836229e68689ad918cc.tar.bz2
pdf-calendars-033cfbe2134f8798fb9f2836229e68689ad918cc.zip
Add formatted days to data structure
-rw-r--r--lib/carlosgoce/calendar.rb10
1 files changed, 4 insertions, 6 deletions
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
}