dohutil 0.2.14 → 0.2.15
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/datewithtime.rb +10 -0
- data/lib/dohutil/current_date.rb +1 -1
- metadata +3 -4
- data/lib/dohutil/core_ext/random.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2de6b7bc26a1564bbbd0264d949e62c47ed5c9e
|
4
|
+
data.tar.gz: 5d44a1d2bf47503018e9e2b8800d339bf92e382a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d3d281cc7588f75162046022593780ee0e41f468fff0e93c845c013485461934fe90c25a3e8d2b71d2585377f2941d44071797eb8f073bc78331c207203568e
|
7
|
+
data.tar.gz: a4e3c947bd80b804e1db9de21de298d3d59156a1ace88eca34d3c5b8590952d678ad4067c56963690b58c59b175a6a6d51a9ca51eb160788e36639c117bc34fc
|
@@ -7,6 +7,11 @@ class DateTime
|
|
7
7
|
SECONDS_IN_DAY = Rational(1, 60 * 60 * 24)
|
8
8
|
end
|
9
9
|
|
10
|
+
def self.zow
|
11
|
+
obj = now
|
12
|
+
new(obj.year, obj.month, obj.mday, obj.hour, obj.min, obj.sec, 0)
|
13
|
+
end
|
14
|
+
|
10
15
|
def self.seconds_to_days(seconds)
|
11
16
|
seconds.to_f * SECONDS_IN_DAY #.to_f
|
12
17
|
end
|
@@ -26,6 +31,11 @@ class DateTime
|
|
26
31
|
end
|
27
32
|
|
28
33
|
class Time
|
34
|
+
def self.zow
|
35
|
+
obj = now
|
36
|
+
new(obj.year, obj.month, obj.mday, obj.hour, obj.min, obj.sec, 0)
|
37
|
+
end
|
38
|
+
|
29
39
|
def next_second(n = 1)
|
30
40
|
self + n
|
31
41
|
end
|
data/lib/dohutil/current_date.rb
CHANGED
@@ -9,7 +9,7 @@ def current_date(dflt = Date.today)
|
|
9
9
|
@current_date_stack.last.to_date
|
10
10
|
end
|
11
11
|
|
12
|
-
def current_datetime(dflt = DateTime.
|
12
|
+
def current_datetime(dflt = DateTime.zow)
|
13
13
|
return dflt if @current_date_stack.empty?
|
14
14
|
cdo = @current_date_stack.last
|
15
15
|
return cdo if cdo.respond_to?(:hour)
|
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.15
|
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: 2013-06-
|
12
|
+
date: 2013-06-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dohroot
|
@@ -77,7 +77,6 @@ files:
|
|
77
77
|
- lib/dohutil/core_ext/force_deep_copy.rb
|
78
78
|
- lib/dohutil/core_ext/hash.rb
|
79
79
|
- lib/dohutil/core_ext/inspect.rb
|
80
|
-
- lib/dohutil/core_ext/random.rb
|
81
80
|
- lib/dohutil/core_ext/string.rb
|
82
81
|
- lib/dohutil/current_date.rb
|
83
82
|
- lib/dohutil/env.rb
|
@@ -109,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
108
|
version: '0'
|
110
109
|
requirements: []
|
111
110
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.0.
|
111
|
+
rubygems_version: 2.0.3
|
113
112
|
signing_key:
|
114
113
|
specification_version: 4
|
115
114
|
summary: assorted tiny utilities
|