datte 0.5.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f0e1c8fca7c6a73723a3bc60574de95c406468d
4
- data.tar.gz: 1078bb00faf8a3bbacfcf5a0628d4c21fc69e540
3
+ metadata.gz: 47ea673d705622d1bdc0a948f5176642ced4efb1
4
+ data.tar.gz: 23d0c88f4952ab62f3e6930c923f38bbde6b7d5b
5
5
  SHA512:
6
- metadata.gz: e8034556e393d1f32c190701ea4bfbaee059c1887afe2822f8836ce05988a7f19248484a134e80371ee0fb932797cdaf7ec19c9a5e8922c94f4f3fda11dec2ec
7
- data.tar.gz: f8e3320d07bfd9897e34d3aead8ff0713226c77b1fca081e75b7d931cae1939b3f3c7db0ab9703abe21074e541bd26e1bd1a31317c2d1f9f2007fc575aa607b3
6
+ metadata.gz: 67e32414d8019a6ce6dad8b9c20f73069b12a3567d7485d3a2fb1234ad64077a0149a7ac3d93df920981f52a1cf9130155602516ea155e9b86198dc9977b5dd1
7
+ data.tar.gz: 4f4020ee371670fb1671f1795f62182c52062fc74cbbfd733ab61f2b1c119c52883b1f445e3a58146b236f2fef1f4f55c2b1a12303cef3f691adc00e0c8a804d
@@ -35,11 +35,23 @@ module Datte
35
35
 
36
36
  # 何年後、何ヶ月後、何日後, 何時間後, 何分後
37
37
  def after(md)
38
- @date >> (md[:year].to_i * 12) if md.matched?(:year) # 何年後
39
- @date >> md[:month].to_i if md.matched?(:month) # 何ヶ月後
40
- @date + md[:day].to_i if md.matched?(:day) # 何日後
41
- @date + Rational(md[:hour].to_i, 24) # 何時間後
42
- @date + Rational(md[:hour].to_i, 24 * 60) # 何分後
38
+ if md.matched?(:year)
39
+ @year, @month, @day = now[:year] + md[:year].to_i, now[:month], now[:day]
40
+ end
41
+ if md.matched?(:month)
42
+ @year, @month, @day = now[:year], now[:month] + md[:month].to_i, now[:day]
43
+ end
44
+ if md.matched?(:day)
45
+ @year, @month, @day = now[:year], now[:month], now[:day] + md[:day].to_i
46
+ end
47
+ if md.matched?(:hour)
48
+ @hour, @min = now[:hour] + md[:hour].to_i, now[:min]
49
+ end
50
+ # @date >> (md[:year].to_i * 12) if md.matched?(:year) # 何年後
51
+ # @date >> md[:month].to_i if md.matched?(:month) # 何ヶ月後
52
+ # @date + md[:day].to_i if md.matched?(:day) # 何日後
53
+ # @date + Rational(md[:hour].to_i, 24) if md.matched?(:hour) # 何時間後
54
+ # @date + Rational(md[:hour].to_i, 24 * 60) if md.matched?(:hour) # 何分後
43
55
  end
44
56
 
45
57
  private
data/lib/datte/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Datte
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datte
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pokohide
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-15 00:00:00.000000000 Z
11
+ date: 2017-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler