dohutil 0.2.25 → 0.2.26
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/lib/dohutil/core_ext/random.rb +8 -0
- data/lib/dohutil/current_date.rb +9 -0
- data/test/current_date.dt.rb +17 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cc48dc755e063824e8319710da5d1f8dbc1ed4d
|
4
|
+
data.tar.gz: 24d678ec7356b5d9f734d9914ec5e04c26c0c2eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2832dd535bd832f54f37590b6a865c7cd781d05e200eb5c83781e3758f2a52243549d1a41e210dcb16ff9dc3e5239776c4437aebd02b53e7f58c1f67d3b78a7f
|
7
|
+
data.tar.gz: f80512c242c33100856bd921351b0cf832cfc28ca8c7eb12a469d26ea4f1304f499e2b14f95c5026a65bd69d94a7ae7c9c887843e43d1db4f03fe6cb71b26541
|
data/lib/dohutil/current_date.rb
CHANGED
@@ -46,4 +46,13 @@ def date_as(date_obj)
|
|
46
46
|
retval
|
47
47
|
end
|
48
48
|
|
49
|
+
# keep the current date, but set the time
|
50
|
+
def time_as(hour, minute, second)
|
51
|
+
cdo = Doh.current_datetime
|
52
|
+
new_time = DateTime.new(cdo.year, cdo.month, cdo.day, hour, minute, second, cdo.zone)
|
53
|
+
date_as(new_time) do
|
54
|
+
yield
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
49
58
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'dohutil/current_date'
|
2
|
+
|
3
|
+
module Doh
|
4
|
+
|
5
|
+
class TestCurrentDate < DohTest::TestGroup
|
6
|
+
def test_date_as_and_time_as
|
7
|
+
cdo = DateTime.new(2016,1,1,1,1,1)
|
8
|
+
Doh.date_as(cdo) do
|
9
|
+
assert_equal(cdo, Doh.current_datetime)
|
10
|
+
Doh.time_as(10,5,3) do
|
11
|
+
assert_equal(DateTime.new(2016,1,1,10,5,3), Doh.current_datetime)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dohutil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Makani Mason
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-04-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dohroot
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- lib/dohutil/core_ext/force_deep_copy.rb
|
100
100
|
- lib/dohutil/core_ext/hash.rb
|
101
101
|
- lib/dohutil/core_ext/inspect.rb
|
102
|
+
- lib/dohutil/core_ext/random.rb
|
102
103
|
- lib/dohutil/core_ext/string.rb
|
103
104
|
- lib/dohutil/current_date.rb
|
104
105
|
- lib/dohutil/disable_verbose.rb
|
@@ -113,6 +114,7 @@ files:
|
|
113
114
|
- test/core_ext/datewithtime.dt.rb
|
114
115
|
- test/core_ext/force_deep_copy.dt.rb
|
115
116
|
- test/core_ext/string.dt.rb
|
117
|
+
- test/current_date.dt.rb
|
116
118
|
- test/exception.dt.rb
|
117
119
|
- test/move_weekday.dt.rb
|
118
120
|
homepage: https://github.com/atpsoft/dohutil
|
@@ -146,5 +148,6 @@ test_files:
|
|
146
148
|
- test/core_ext/datewithtime.dt.rb
|
147
149
|
- test/core_ext/force_deep_copy.dt.rb
|
148
150
|
- test/core_ext/string.dt.rb
|
151
|
+
- test/current_date.dt.rb
|
149
152
|
- test/exception.dt.rb
|
150
153
|
- test/move_weekday.dt.rb
|