eitil 0.3.7 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24a0dccf0357bf5e01f41be73b6b1d4c840cbb8efa233ab772ad1c6c8bd94cff
4
- data.tar.gz: 7dc80a7a0268a68302fa74ddc1e0f371a83fba8a77dee2cb38a5ad03c08b3688
3
+ metadata.gz: f742ee647b11b18765c5022fe55301317822282c3443cd161e0d49ded69678cf
4
+ data.tar.gz: 10aa2196982292c2cab87a25906b59eba9147294dfdddaafce8a53eb8521c7b7
5
5
  SHA512:
6
- metadata.gz: 6d4a5e8baadfbd18962a5452e42b2051dff922765fbd2a53dcbe15a415a8e805a031efe18defc70d7360f52701d12b2ddcbbc07a96dc8ae2cffd3c33e121a636
7
- data.tar.gz: 83a19e9611e3553faf36663b5676c1abb3bc81af22052014cc250f8230665ce36b98a606a4a834923d2c24d81f7c347fa27ab91171a1cd74ca25a871e81d4e7a
6
+ metadata.gz: 13b655a01ff36fd371f50cc9868409a0a0d51520afffaf3d8871bd9955a502bf342945f51d0f551cbd9c58b97bdcc6fa7d28f9a09ee06b9c1e127764abbc3854
7
+ data.tar.gz: c7a02991659f2c23d9c4846d2377e6160a3f15fdd0119f231ad1e78fef0686ba651c35c25b283f49405cd5f1fc545d40d082c7ff7639ee080cef76d8b25ff7b6
data/README.md CHANGED
@@ -103,6 +103,20 @@ include_concerns_of(*directories, namespace: nil)
103
103
 
104
104
 
105
105
 
106
+ ## String
107
+
108
+ ```ruby
109
+ is_num?
110
+ # returns true if a string matches the Rubinius source code regex for strings and integers, false otherwise
111
+ # comes in handy since ruby plays it safe on string to number conversion ('aaa'.to_f returns 0.0, thus is valid)
112
+
113
+ is_nan?
114
+ # returns true if a string does NOT match the Rubinius source code regex for strings and integers, false otherwise
115
+ # comes in handy since ruby plays it safe on string to number conversion ('aaa'.to_f returns 0.0, thus is valid)
116
+ ```
117
+
118
+
119
+
106
120
  ## Hash
107
121
 
108
122
  ```ruby
@@ -0,0 +1,16 @@
1
+ class String
2
+
3
+ # The NumberRegex belows comes from the Rubinius source code and
4
+ # identifies both integers and floats correctly.
5
+
6
+ NumberRegex = /^\s*[+-]?((\d+_?)*\d+(\.(\d+_?)*\d+)?|\.(\d+_?)*\d+)(\s*|([eE][+-]?(\d+_?)*\d+)\s*)$/
7
+
8
+ def is_nan?
9
+ self !~ NumberRegex
10
+ end
11
+
12
+ def is_num?
13
+ !is_nan?
14
+ end
15
+
16
+ end
data/lib/eitil/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eitil
2
- VERSION = '0.3.7'
2
+ VERSION = '0.3.8'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eitil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jurriaan Schrofer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-07 00:00:00.000000000 Z
11
+ date: 2021-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -63,6 +63,7 @@ files:
63
63
  - config/initializers/monkeys/kernel.rb
64
64
  - config/initializers/monkeys/module.rb
65
65
  - config/initializers/monkeys/object.rb
66
+ - config/initializers/monkeys/string.rb
66
67
  - config/initializers/wrappers/decorators/application_decorator.rb
67
68
  - config/initializers/wrappers/decorators/controller_decorator.rb
68
69
  - config/initializers/wrappers/jobs/active_job_macros.rb