fe_core_ext 0.8.3 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -3
- data/fe_core_ext.gemspec +2 -2
- data/lib/fe_core_ext/core_ext/date.rb +21 -0
- data/lib/fe_core_ext/core_ext/pathname.rb +11 -1
- data/lib/fe_core_ext/core_ext/uri.rb +1 -1
- data/lib/fe_core_ext/version.rb +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e75f967878190d148dcc5d19d3b4643c28c9294c2c1027983a3eeed844a20636
|
4
|
+
data.tar.gz: 27c1d0c08f0e17167f5654f7335ddc7644b3113946b232ce3432f97812e27453
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4461a9de058140d1457eeb1b75ed2186911fc38b441c130f15c2f6c4638b6bd71eeb44b1290e367e010e581e451c447bb6e3b04ee14a8a3a68e8c1e654a8b01e
|
7
|
+
data.tar.gz: 915a568bdadf01910e9f7775dcd4431c31f0b196d3d319e71d550d27103fe42753b66f76521fa38b020e5b5909c76803ed40b712b7bf794d073e104936a0edb5
|
data/Rakefile
CHANGED
data/fe_core_ext.gemspec
CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
22
|
spec.add_runtime_dependency 'activesupport'
|
23
|
-
spec.add_development_dependency 'bundler', '~> 1
|
24
|
-
spec.add_development_dependency 'rake', '~>
|
23
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
24
|
+
spec.add_development_dependency 'rake', '~> 12.3'
|
25
25
|
spec.add_development_dependency 'rspec', '~> 0'
|
26
26
|
spec.add_development_dependency 'selenium-webdriver', '~> 0'
|
27
27
|
end
|
@@ -19,6 +19,15 @@ module FeCoreExt::CoreExt::Date
|
|
19
19
|
end
|
20
20
|
|
21
21
|
module FeCoreExt::CoreExt::DateClassMethods
|
22
|
+
def parsable?(string)
|
23
|
+
begin
|
24
|
+
parse(string)
|
25
|
+
true
|
26
|
+
rescue ArgumentError
|
27
|
+
false
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
22
31
|
def parse_as_future(string)
|
23
32
|
date = parse(string)
|
24
33
|
date > current ? date : date + 1.year
|
@@ -29,6 +38,18 @@ module FeCoreExt::CoreExt::DateClassMethods
|
|
29
38
|
Date.new($1.to_i + 1988, $2.to_i, $3.to_i)
|
30
39
|
}
|
31
40
|
end
|
41
|
+
|
42
|
+
def parse_reiwa(string)
|
43
|
+
string.match('令和(\S+)年(\d+)月(\d+)日') {
|
44
|
+
year = 1 if $1 == '元'
|
45
|
+
year ||= $1.to_i
|
46
|
+
Date.new(year + 2018, $2.to_i, $3.to_i)
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
def parse_gengo(string)
|
51
|
+
parse_heisei(string) || parse_reiwa(string)
|
52
|
+
end
|
32
53
|
end
|
33
54
|
|
34
55
|
class Date
|
@@ -31,6 +31,16 @@ module FeCoreExt::CoreExt::Pathname
|
|
31
31
|
def require_relative
|
32
32
|
Kernel.require_relative(self)
|
33
33
|
end
|
34
|
+
|
35
|
+
def mktmpdir(prefix_suffix=nil, tmpdir=nil)
|
36
|
+
if block_given?
|
37
|
+
Dir.mktmpdir prefix_suffix, tmpdir do |dir|
|
38
|
+
yield new(dir)
|
39
|
+
end
|
40
|
+
else
|
41
|
+
new(Dir.mktmpdir(prefix_suffix, tmpdir))
|
42
|
+
end
|
43
|
+
end
|
34
44
|
end
|
35
45
|
|
36
46
|
module FeCoreExt::CoreExt::PathnameClassMethods
|
@@ -42,4 +52,4 @@ end
|
|
42
52
|
class Pathname
|
43
53
|
extend FeCoreExt::CoreExt::PathnameClassMethods
|
44
54
|
include FeCoreExt::CoreExt::Pathname
|
45
|
-
end
|
55
|
+
end
|
data/lib/fe_core_ext/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module FeCoreExt
|
2
|
-
VERSION = '0.
|
3
|
-
end
|
2
|
+
VERSION = '0.11.0'
|
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.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tetsu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1
|
33
|
+
version: '2.1'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1
|
40
|
+
version: '2.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '12.3'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '12.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
version: '0'
|
132
132
|
requirements: []
|
133
133
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.7.6
|
134
|
+
rubygems_version: 2.7.6.2
|
135
135
|
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: Core class extensions
|