fe_core_ext 0.14.1 → 0.16.1
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 +18 -0
- 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: 24210816b8a1376ab6234ec60570a056d2b7887501f8f9311e8a810bd7fa3212
|
4
|
+
data.tar.gz: 4d455281c1f2c002286d9825b9fa4577288d2fe220219b0a0e0544765b1335a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 534d9a1092afe7b3b7c40b9ed5da04a034ea5e0fac0fec76eab168d5c08512ed95415dac80c8ff12fc5742337251164413732d6c7e1a165064d7ee33201423ea
|
7
|
+
data.tar.gz: 36a0671916faccc840804b6dc157cca33416f47b9bdaacf1ae13c5759f45719ab25a5f769f757003db19867a4aab60aa3575ce60010d6da033136ad2123ba2f9
|
@@ -12,11 +12,25 @@ module FeCoreExt::CoreExt::String
|
|
12
12
|
delete(',').to_i
|
13
13
|
end
|
14
14
|
|
15
|
+
def to_integer_new
|
16
|
+
return unless valid_number?
|
17
|
+
delete(',').to_i
|
18
|
+
end
|
19
|
+
|
20
|
+
def integer?
|
21
|
+
self.to_integer.to_s == self.delete(',')
|
22
|
+
end
|
23
|
+
|
15
24
|
def to_decimal
|
16
25
|
return if not_number?
|
17
26
|
delete(',').to_d
|
18
27
|
end
|
19
28
|
|
29
|
+
def to_decimal_new
|
30
|
+
return unless valid_number?
|
31
|
+
delete(',').to_d
|
32
|
+
end
|
33
|
+
|
20
34
|
def to_pathname
|
21
35
|
Pathname(self)
|
22
36
|
end
|
@@ -25,6 +39,10 @@ module FeCoreExt::CoreExt::String
|
|
25
39
|
to_i == 0 && match('0').nil?
|
26
40
|
end
|
27
41
|
|
42
|
+
def valid_number?
|
43
|
+
match?(/^[\d\,\.]+$/)
|
44
|
+
end
|
45
|
+
|
28
46
|
## deprecated
|
29
47
|
def zen_to_han
|
30
48
|
tr('0-9A-Za-z &・-()', '0-9A-Za-z &・\-()')
|
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.16.1
|
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: 2022-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|