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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/compact_time.rb +6 -10
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef9424c978b6d67e23e0ca5910310e2d9db29c5d
4
- data.tar.gz: 673816757522776805f8085edad801d61b77f21e
3
+ metadata.gz: 576a5d5ee100c701f14d252377312bec4fb71f40
4
+ data.tar.gz: 25a7342f3d9d97decc32c09f838865aeae780f27
5
5
  SHA512:
6
- metadata.gz: 60bc286bc2a6a66c1de6af2ae969fd8aa3f3dc0592bf6087c4f8d5c38c49c926e6dec5cb0384cdae0633460a98b0851bb28a74b5ffdd99a15e7771cb19131c00
7
- data.tar.gz: f8717165ce0ce39b366f7771876a3d8d02b101c4f5b9b16b18ee7a293113a736d759757fe1b097c6906b19f1fcefe3edf6d0cc04fc838ea169bd1bdfa3301bb7
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; [iyear, season, sweek, wday, hour, min, sec, usec] end
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 iyear; strftime("%G").to_i end
17
- def season; Alph[strftime("%V").to_i.-(1)./(13).+(1)] end
18
- def sweek; strftime("%V").to_i.-(1).%(13).+(1) end
19
- def wday; Alph[strftime("%u").to_i] end
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.1
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-29 00:00:00.000000000 Z
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: