compact_time 0.1.1 → 0.2.1
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/compact_time.rb +7 -7
- 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: 684f744523ebeb68a016e4cc82ad799053708b13
|
4
|
+
data.tar.gz: 3644539d1d990ddcf714f66426a9cdb50a876e4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bd870120a0cc3ab492abc1d635855f8bc383e1efaa2f32217f47b3e71a6f171760905136e1eaedc4f0a4471b25b04f21d60642899c1bca3ae90ac601c66cc30
|
7
|
+
data.tar.gz: 46ea07dffeac663c88a835154142262f46aa5cc08684eff6724585f4bedf5650508d3bc69be4dcc9bda1b862695cc827f5cef3fd47d7d8df4c771361042a30a6
|
data/lib/compact_time.rb
CHANGED
@@ -3,15 +3,15 @@
|
|
3
3
|
class Time
|
4
4
|
def till_now; self.class.now - self end
|
5
5
|
def compact_array; [cpt_year % 100, cpt_season, cpt_week, cpt_day, hour, min, cpt_offset] end
|
6
|
-
def compact; "%02d%s-%02d%s-T%02d%02d%s" % compact_array end
|
6
|
+
def compact; "%02d%s-%02d%s-T%02d%02d%s".freeze % compact_array end
|
7
7
|
def full_array; [cpt_year, cpt_season, cpt_week, cpt_day, hour, min, cpt_offset, sec, usec] end
|
8
|
-
def full; "%d%s-%02d%s-T%02d%02d%s-S%02d%06d" % full_array end
|
8
|
+
def full; "%d%s-%02d%s-T%02d%02d%s-S%02d%06d".freeze % full_array end
|
9
9
|
|
10
10
|
private
|
11
11
|
Alph = %w[dummy A B C D E F G]
|
12
|
-
def cpt_year; strftime("%G").to_i end
|
13
|
-
def cpt_season; Alph[strftime("%V").to_i.-(1)./(13).+(1)] end
|
14
|
-
def cpt_week; strftime("%V").to_i.-(1).%(13).+(1) end
|
15
|
-
def cpt_day; Alph[strftime("%u").to_i] end
|
16
|
-
def cpt_offset; strftime("%z") end
|
12
|
+
def cpt_year; strftime("%G".freeze).to_i end
|
13
|
+
def cpt_season; Alph[strftime("%V".freeze).to_i.-(1)./(13).+(1)] end
|
14
|
+
def cpt_week; strftime("%V".freeze).to_i.-(1).%(13).+(1) end
|
15
|
+
def cpt_day; Alph[strftime("%u".freeze).to_i] end
|
16
|
+
def cpt_offset; strftime("%z".freeze) end
|
17
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: compact_time
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ''
|
14
14
|
email: []
|
@@ -36,7 +36,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
36
36
|
version: '0'
|
37
37
|
requirements: []
|
38
38
|
rubyforge_project:
|
39
|
-
rubygems_version: 2.1.
|
39
|
+
rubygems_version: 2.1.10
|
40
40
|
signing_key:
|
41
41
|
specification_version: 4
|
42
42
|
summary: Compact way of expressing time
|