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 +4 -4
- data/README.md +14 -0
- data/config/initializers/monkeys/string.rb +16 -0
- data/lib/eitil/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f742ee647b11b18765c5022fe55301317822282c3443cd161e0d49ded69678cf
|
4
|
+
data.tar.gz: 10aa2196982292c2cab87a25906b59eba9147294dfdddaafce8a53eb8521c7b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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.
|
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-
|
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
|