fe_core_ext 0.17.3 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fe_core_ext/core_ext/string.rb +8 -0
- data/lib/fe_core_ext/core_ext/uri.rb +3 -3
- data/lib/fe_core_ext/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0364ab21f7962e38946bcc1eaa4a5ce21fa8571a9b213dad6e8111364cc74da
|
4
|
+
data.tar.gz: 608b759ccf5e6f4757ab34e9de5cea96089085fa2dab1b3fca127a55e4c33ef8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 857122c00132f4033cd38797164b77e21bcf7e6402f870d138d91df72a0074db6cabf7a49224f3f3e9490702a46fbc0d48e0b78d77a0fe8d4806f6d280aa6852
|
7
|
+
data.tar.gz: eda69153e67aa641014cc7305fe61992aad8065723f9e2fae1ba5241dd60a5e132553b94be95be36dd4adccd241dc802efcc73535b499d05d4040f234210b717
|
@@ -75,9 +75,17 @@ module FeCoreExt::CoreExt::String
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def to_date_in_ja
|
78
|
+
to_date_in_ja_seireki || to_date_in_ja_heisei
|
79
|
+
end
|
80
|
+
|
81
|
+
def to_date_in_ja_seireki
|
78
82
|
match(/(\d{4})年(\d{1,2})月(\d{1,2})日/) {Date.new($1.to_i, $2.to_i, $3.to_i)}
|
79
83
|
end
|
80
84
|
|
85
|
+
def to_date_in_ja_heisei
|
86
|
+
match(/平成(\d{2})年(\d{1,2})月(\d{1,2})日/) {Date.new($1.to_i + 1988, $2.to_i, $3.to_i)}
|
87
|
+
end
|
88
|
+
|
81
89
|
# remove also no break space and other space like characters.
|
82
90
|
def strong_strip
|
83
91
|
reverse.gsub(/^\p{Zs}+|^\p{Cf}+/, '').reverse.gsub(/^\p{Zs}+|^\p{Cf}+/, '')
|
@@ -8,11 +8,11 @@ end
|
|
8
8
|
|
9
9
|
module URI
|
10
10
|
def download(file)
|
11
|
+
warn 'URI#downloadの引数にはPathnameを使いましょう!' if file.is_a?(String)
|
11
12
|
binary = OpenURI.open_uri(self).read
|
13
|
+
file = file + self.basename if file.to_s[-1] == '/'
|
12
14
|
dirname = ::File.dirname(file)
|
13
|
-
unless ::File.directory?(dirname)
|
14
|
-
::FileUtils.mkdir_p(dirname)
|
15
|
-
end
|
15
|
+
::FileUtils.mkdir_p(dirname) unless ::File.directory?(dirname)
|
16
16
|
::File.open(file, 'wb') {|f| f.write(binary)}
|
17
17
|
end
|
18
18
|
|
data/lib/fe_core_ext/version.rb
CHANGED
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.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tetsu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|