timecop 0.9.5 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.markdown +1 -1
- data/lib/timecop/time_extensions.rb +8 -13
- data/lib/timecop/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c86a01ea95f5019cb15a6a66c5668e68e7f1e293ca14b910a10cbe1cdd70d668
|
4
|
+
data.tar.gz: e5c6987d3a452fa9ead841021f93bf4ea6bac713c1f6cea38cfc1c1d49baf6ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4abbcd2d37b9fdf6dfb1ed1f63f945a882cd62a47ae2ae237da003ccac0bc660572be0800933ea484fb1632707bdc2de457b96f9aad8a62b1dfd96d766220692
|
7
|
+
data.tar.gz: a19cc9026478a29161a832454edebf76105d56d3841575af71e9dbaa305a40a68af285d17b7473369ae913e463cadd7b67ab2e099d13d3162b713d2c3cd87d05
|
data/README.markdown
CHANGED
@@ -45,36 +45,31 @@ class Date #:nodoc:
|
|
45
45
|
alias_method :strptime_without_mock_date, :strptime
|
46
46
|
|
47
47
|
def strptime_with_mock_date(str = '-4712-01-01', fmt = '%F', start = Date::ITALY)
|
48
|
-
unless start == Date::ITALY
|
49
|
-
raise ArgumentError, "Timecop's #{self}::#{__method__} only " +
|
50
|
-
"supports Date::ITALY for the start argument."
|
51
|
-
end
|
52
|
-
|
53
48
|
#If date is not valid the following line raises
|
54
|
-
Date.strptime_without_mock_date(str, fmt)
|
49
|
+
Date.strptime_without_mock_date(str, fmt, start)
|
55
50
|
|
56
51
|
d = Date._strptime(str, fmt)
|
57
52
|
now = Time.now.to_date
|
58
53
|
year = d[:year] || now.year
|
59
54
|
mon = d[:mon] || now.mon
|
60
55
|
if d.keys == [:year]
|
61
|
-
Date.new(year)
|
56
|
+
Date.new(year, 1, 1, start)
|
62
57
|
elsif d[:mday]
|
63
|
-
Date.new(year, mon, d[:mday])
|
58
|
+
Date.new(year, mon, d[:mday], start)
|
64
59
|
elsif d[:wday]
|
65
|
-
Date.new(year, mon, now.mday) + (d[:wday] - now.wday)
|
60
|
+
Date.new(year, mon, now.mday, start) + (d[:wday] - now.wday)
|
66
61
|
elsif d[:yday]
|
67
|
-
Date.new(year).next_day(d[:yday] - 1)
|
62
|
+
Date.new(year, 1, 1, start).next_day(d[:yday] - 1)
|
68
63
|
elsif d[:cwyear] && d[:cweek]
|
69
64
|
if d[:cwday]
|
70
|
-
Date.commercial(d[:cwyear], d[:cweek], d[:cwday])
|
65
|
+
Date.commercial(d[:cwyear], d[:cweek], d[:cwday], start)
|
71
66
|
else
|
72
|
-
Date.commercial(d[:cwyear], d[:cweek])
|
67
|
+
Date.commercial(d[:cwyear], d[:cweek], 1, start)
|
73
68
|
end
|
74
69
|
elsif d[:seconds]
|
75
70
|
Time.at(d[:seconds]).to_date
|
76
71
|
else
|
77
|
-
Date.new(year, mon)
|
72
|
+
Date.new(year, mon, 1, start)
|
78
73
|
end
|
79
74
|
end
|
80
75
|
|
data/lib/timecop/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timecop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Jeffery
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-11-29 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A gem providing "time travel" and "time freezing" capabilities, making
|
15
15
|
it dead simple to test time-dependent code. It provides a unified method to mock
|
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
|
-
rubygems_version: 3.2.
|
57
|
+
rubygems_version: 3.2.15
|
58
58
|
signing_key:
|
59
59
|
specification_version: 3
|
60
60
|
summary: A gem providing "time travel" and "time freezing" capabilities, making it
|