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 +4 -4
- data/lib/datte/dattetime.rb +17 -5
- data/lib/datte/version.rb +1 -1
- 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: 47ea673d705622d1bdc0a948f5176642ced4efb1
|
4
|
+
data.tar.gz: 23d0c88f4952ab62f3e6930c923f38bbde6b7d5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67e32414d8019a6ce6dad8b9c20f73069b12a3567d7485d3a2fb1234ad64077a0149a7ac3d93df920981f52a1cf9130155602516ea155e9b86198dc9977b5dd1
|
7
|
+
data.tar.gz: 4f4020ee371670fb1671f1795f62182c52062fc74cbbfd733ab61f2b1c119c52883b1f445e3a58146b236f2fef1f4f55c2b1a12303cef3f691adc00e0c8a804d
|
data/lib/datte/dattetime.rb
CHANGED
@@ -35,11 +35,23 @@ module Datte
|
|
35
35
|
|
36
36
|
# 何年後、何ヶ月後、何日後, 何時間後, 何分後
|
37
37
|
def after(md)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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
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.
|
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-
|
11
|
+
date: 2017-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|