week_calc 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/week_calc.rb +7 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a072585efe5857ff1439e3cb3170d09f7884b26
|
4
|
+
data.tar.gz: f52cf7511fea92c40f53b997a25af616838479ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d5d485e9fb659105c66a7999671667a4876ea2a8b1b525725a9a73da1f79b5bfe9785c9be063b10b8137aae6119a7d3cc2cb653b140a2ef98c4030d44529d10
|
7
|
+
data.tar.gz: cecdc2768712e494658c83121a11ba555e91813e1a89d5be023b64783fb50f267dffd3ba966a10507250998bfe380860473e90916bff64e32afd3517a45a24c8
|
data/lib/week_calc.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'date'
|
2
2
|
Date.class_eval do
|
3
|
-
def self.
|
3
|
+
def self.weeks_in_between(start_date, end_date)
|
4
4
|
#Calculations will return a date object
|
5
5
|
start_date_parsed = Date.parse(start_date) rescue nil
|
6
6
|
end_date_parsed = Date.parse(end_date) rescue nil
|
@@ -12,7 +12,7 @@ Date.class_eval do
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def self.
|
15
|
+
def self.weeks_from_now(date)
|
16
16
|
date_parsed = Date.parse(date) rescue nil
|
17
17
|
if date_parsed.nil?
|
18
18
|
nil
|
@@ -21,4 +21,9 @@ Date.class_eval do
|
|
21
21
|
weeks = (days_gap/7).abs
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
# Method Aliases
|
26
|
+
class << self
|
27
|
+
alias_method :weeks_till_now, :weeks_from_now
|
28
|
+
end
|
24
29
|
end
|