compact_time 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/compact_time.rb +10 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf82e535cf1d9d8e1b66223dd783a65bb1f65922
4
- data.tar.gz: f278ac4035fe44aeb4cdf469cc4b6c9e6318d5d9
3
+ metadata.gz: 413cb68ec83223ef6dd8fc2b076400aeaf258dde
4
+ data.tar.gz: 77caae143fbe87d6ba82fb8d44ce1d8644c3dca9
5
5
  SHA512:
6
- metadata.gz: 3e7e92249fe9e1b2d44fe1ad8774fa53f87c1e2f3121c080afff93618499f677400574522de95294cb64a57069316ee886ec5e0a8f11ce26b32cfe4737e056f4
7
- data.tar.gz: 1f9c4a41ecdd3ce83d3b9aca38a186ba31f045b16c9900f8769b600b7f5a49646d81c74ee2714534065cc52892229455a3987a9d2fc61500b2b8deb56883d597
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; Alph[strftime("%V".freeze).to_i.-(1)./(13).+(1)] end
22
- def cpt_week; strftime("%V".freeze).to_i.-(1).%(13).+(1) end
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.5.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-07-28 00:00:00.000000000 Z
11
+ date: 2014-09-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ''
14
14
  email: []