theusual 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/theusual/time.rb +13 -0
- data/lib/theusual/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6af68770c8a5f6f30a66ea5dc1288c437e82f39c
|
4
|
+
data.tar.gz: 15e247e1587c85d4148d73ae4b7e9fe09d1dc627
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54c0b663bbe157dc87899136c0fe69f41b048ca68ea1f1ffa069294724603542c5f4980eac736989647e1e1e8e8e4227dcccf29b472c716b9e546a3317d91727
|
7
|
+
data.tar.gz: 2f2954952235ae2812cb04e51d45947a48e881a2aabd4a71b0feb72b8c42f1b5f4aaee7b8a13d0a8e88bbfff61d4ca0857ef97c5d20157dfd0693ba46874867f
|
data/lib/theusual/time.rb
CHANGED
@@ -1,4 +1,16 @@
|
|
1
1
|
class Time
|
2
|
+
|
3
|
+
def self.at_ms ms
|
4
|
+
# convert an integer representing Unix time in milliseconds
|
5
|
+
ms ? Time.at(ms / 1_000.0).utc : nil
|
6
|
+
end
|
7
|
+
|
8
|
+
def to_ms
|
9
|
+
# return the number of milliseconds since the Unix epoc
|
10
|
+
(to_f * 1_000).to_i
|
11
|
+
end
|
12
|
+
|
13
|
+
|
2
14
|
def humanize
|
3
15
|
a = (Time.now.utc - self.utc).to_i
|
4
16
|
|
@@ -16,4 +28,5 @@ class Time
|
|
16
28
|
else ((a+180000)/(60*60*24*7)).to_i.to_s + ' weeks ago'
|
17
29
|
end
|
18
30
|
end
|
31
|
+
|
19
32
|
end
|
data/lib/theusual/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: theusual
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Pepper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.6.10
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: TheUsual
|