compact_time 0.5.0 → 0.6.0
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 +10 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 413cb68ec83223ef6dd8fc2b076400aeaf258dde
|
4
|
+
data.tar.gz: 77caae143fbe87d6ba82fb8d44ce1d8644c3dca9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03049656dd07eb9ff63b55671795d4e0eb7639c1f0c1cdd6e4f2e484414973f48a59ee329489bcbadf87440e384d64abfcf02646874b7e2ef9757b3e692f263a
|
7
|
+
data.tar.gz: cb027cdd4778d2968fe4d5faff34e2e83fbd3edaeb0cd61d596fb6c4c63f2c6c4db098cf4c0d857d25ea14d5a3f96caaf77d6ac5df789c908287783fc47938aa
|
data/lib/compact_time.rb
CHANGED
@@ -17,9 +17,17 @@ class Time
|
|
17
17
|
|
18
18
|
private
|
19
19
|
Alph = %w[dummy A B C D E F G]
|
20
|
+
protected def widow_week?; strftime("%V".freeze).to_i == 53 end
|
20
21
|
def cpt_year; strftime("%G".freeze).to_i end
|
21
|
-
def cpt_season
|
22
|
-
|
22
|
+
def cpt_season
|
23
|
+
i = strftime("%V".freeze).to_i.-(1)./(13).+(1)
|
24
|
+
i -= 1 if widow_week?
|
25
|
+
Alph[i]
|
26
|
+
end
|
27
|
+
def cpt_week
|
28
|
+
i = strftime("%V".freeze).to_i.-(1).%(13).+(1)
|
29
|
+
widow_week? ? i + 1 : i
|
30
|
+
end
|
23
31
|
def cpt_day; Alph[strftime("%u".freeze).to_i] end
|
24
32
|
def cpt_offset; strftime("%z".freeze) end
|
25
33
|
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.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ''
|
14
14
|
email: []
|