fe_core_ext 0.8.3 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d05ef0bad357f82033da9e4be5625fdeb5ea43753b81e71979860b748e2e637
4
- data.tar.gz: 3396e8f707cf0c8a5d6e3e92e7fe24ad0a11a10368d8e6f1a9ca87966216e602
3
+ metadata.gz: 0ad61cadab269ee32452f5beffbbea704da10b231c4283d6e36d50bf15b88f5b
4
+ data.tar.gz: 9a8dbf59f02483aee9579ef822a8ba959da000ce30102b25ebd8522d6d32a500
5
5
  SHA512:
6
- metadata.gz: 2baf8cb95607185ff09e1bcf42ea23dfad8fc26fa5804121347a34d6cc31020350005c8ec94320bb00849c792ec09eacbb886434dc8f733184ab91d4d594fbff
7
- data.tar.gz: 9cfb9ab7c57802c34fa17aabaf14f6cf9c1f77d3ec98fb01f146a644e2e8b5caf187c686745f96687513833a2e841f004e91c05c65ce9bffd7a68cdaebcdf95c
6
+ metadata.gz: 2c0559268079f39269f6b9af9c2509577abd9f18ff8d2037dc71fd30fce96576425e6a1cda15dac89ad81afdf1b5ee50ebbdda373c9044b2f4ea384a730071da
7
+ data.tar.gz: 4b3df4d8d22ea1e737d0bd93262ba555eddc28919a483641fc4c54dc931b182aa7a3fb2126c5bcd2aed15b8b6ab4a2c8633e7cd8acb7df1930667b6af7e9256c
@@ -29,6 +29,18 @@ module FeCoreExt::CoreExt::DateClassMethods
29
29
  Date.new($1.to_i + 1988, $2.to_i, $3.to_i)
30
30
  }
31
31
  end
32
+
33
+ def parse_reiwa(string)
34
+ string.match('令和(\S+)年(\d+)月(\d+)日') {
35
+ year = 1 if $1 == '元'
36
+ year ||= $1.to_i
37
+ Date.new(year + 2018, $2.to_i, $3.to_i)
38
+ }
39
+ end
40
+
41
+ def parse_gengo(string)
42
+ parse_heisei(string) || parse_reiwa(string)
43
+ end
32
44
  end
33
45
 
34
46
  class Date
@@ -1,3 +1,3 @@
1
1
  module FeCoreExt
2
- VERSION = '0.8.3'
2
+ VERSION = '0.9.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fe_core_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tetsu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-11 00:00:00.000000000 Z
11
+ date: 2019-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport