compact_time 0.0.1 → 0.1.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 +6 -10
- 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: 576a5d5ee100c701f14d252377312bec4fb71f40
|
4
|
+
data.tar.gz: 25a7342f3d9d97decc32c09f838865aeae780f27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec54d6f84d3f7da04b8ac38922fe52ee8b0bac553c472cb12717095308be1ba2fd48f8bc933f9857e753e6086e400a3ddac1b242d7d16a124e48e88b256217b9
|
7
|
+
data.tar.gz: de40a111801484b7a2386ac255b77bf312991990e4000d8f4187392bdcc9b4f767c8c7b7e7e5ef50fa172d3436c54a407175bfd52187c7777e2e76aeb5038af6
|
data/lib/compact_time.rb
CHANGED
@@ -2,19 +2,15 @@
|
|
2
2
|
|
3
3
|
class Time
|
4
4
|
def till_now; self.class.now - self end
|
5
|
-
end
|
6
|
-
|
7
|
-
## Not to pollute `Time` class. Especially, redefining `Time#wday` may cause server error.
|
8
|
-
class CompactTime < Time
|
9
|
-
def compact_array; [iyear % 100, season, sweek, wday, hour, min] end
|
5
|
+
def compact_array; [cpt_year % 100, cpt_season, cpt_week, cpt_day, hour, min] end
|
10
6
|
def compact; "%02d%s-%d%s-%02d%02d" % compact_array end
|
11
|
-
def full_array; [
|
7
|
+
def full_array; [cpt_year, cpt_season, cpt_week, cpt_day, hour, min, sec, usec] end
|
12
8
|
def full; "%02d%s-%d%s-%02d%02d-%02d-%06d" % full_array end
|
13
9
|
|
14
10
|
private
|
15
11
|
Alph = %w[dummy A B C D E F G]
|
16
|
-
def
|
17
|
-
def
|
18
|
-
def
|
19
|
-
def
|
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
|
20
16
|
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.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ''
|
14
14
|
email: []
|
@@ -17,7 +17,7 @@ extensions: []
|
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
19
|
- lib/compact_time.rb
|
20
|
-
homepage: http://sawa.github.io/compact_time
|
20
|
+
homepage: http://sawa.github.io/compact_time
|
21
21
|
licenses: []
|
22
22
|
metadata: {}
|
23
23
|
post_install_message:
|