fe_core_ext 0.14.0 → 0.16.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: 5ffc87e87a8dcc8965078c089a5b998a6d187414768289828efad5242ef22cb9
4
- data.tar.gz: 5bb29b2d75f56cd4273efe71865baa9f7afbe42dce03ac5f093a44468081e790
3
+ metadata.gz: abb1e8f1ef4156080de09a8ffa77d430db7f9b7a9a9feecbcefba827cb69fdd7
4
+ data.tar.gz: b6a1efc0ffef8656dc0ac6739cef8281350b94d668f9cf5910373eb3726e2780
5
5
  SHA512:
6
- metadata.gz: d312f23a7b35e8a50514a5b03307d1cd20827f25a1b6b69d078ebefb5b0bf40c9ebb38d5b3ac0eee7fd6db4e398391bb30b5b033c788179512e867e3b6b28f2b
7
- data.tar.gz: fb9c6be1641b7c7e8ecf58d23b40fb6e4722193de794ae84e501058fbdefbf5de88bcdc5c0a41e7223d6dd47bfe4a3266b9f5cc6b1ba5b28d49b3765937dce4e
6
+ metadata.gz: 14cfc80f4a6c5b1afe2a37a3dc534bc10c031785d7044fc631a43192df638c89194a72a00a88169628dde13ef12bcaf7e9495501699b57a0d44767f38754b95d
7
+ data.tar.gz: 8f60f858051738211bdcff7b5014b08ddc8d6dca0bd082a0c2a866e6523110821a8911d90906aa7d645f12021a3f3121e2ba0943477171051e4d1c6755f5f416
@@ -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_i.to_s == self
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 &・\-()')
@@ -1,3 +1,3 @@
1
1
  module FeCoreExt
2
- VERSION = '0.14.0'
2
+ VERSION = '0.16.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.14.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tetsu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-25 00:00:00.000000000 Z
11
+ date: 2022-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport