aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCarlos Goce <carlosgoce@gmail.com>2015-01-24 20:14:56 +0100
committerCarlos Goce <carlosgoce@gmail.com>2015-01-24 20:14:56 +0100
commit47a55ef9ca277fcbce1ad1e908eb2110c2da57b4 (patch)
treef15c9376adc088504c42f6f88b4d8de02f677db5 /lib
parent9c75e0553d3ebce71eb1dc07b1df59f05b05ad2a (diff)
downloadpdf-calendars-47a55ef9ca277fcbce1ad1e908eb2110c2da57b4.tar.gz
pdf-calendars-47a55ef9ca277fcbce1ad1e908eb2110c2da57b4.tar.bz2
pdf-calendars-47a55ef9ca277fcbce1ad1e908eb2110c2da57b4.zip
Add formatted days spec
Diffstat (limited to 'lib')
-rw-r--r--lib/carlosgoce/calendar.rb8
1 files changed, 8 insertions, 0 deletions
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