eitil 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/config/initializers/monkeys/string.rb +81 -1
- data/lib/eitil/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac7bd5bff2af923e06936b0016f4f07f8d4eba225a68dc193bdf5f277bcdbb97
|
4
|
+
data.tar.gz: 193b41fa2a5fde545b189b79a2c94328c242bf45d71ff5802cfab3fb7b95c402
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52c86de08e26441922852f3cd5563a36ac46c585a3ab50745e1f0fc2dacf9dc6187574f54c7c33ba415fdd3be006e0c45b7245076b209fd74a3782b07c1ace34
|
7
|
+
data.tar.gz: 0bf06bc0226924db17b2c9b7f9138eac75116cb4d351fe9818690f2745cfaa68d43eac837dbfb0825b6870eeeb0ab4b50cb091ed05243b533501498d8ca60eac
|
data/README.md
CHANGED
@@ -109,10 +109,12 @@ include_concerns_of(*directories, namespace: nil)
|
|
109
109
|
is_num?
|
110
110
|
# returns true if a string matches the Rubinius source code regex for strings and integers, false otherwise
|
111
111
|
# comes in handy since ruby plays it safe on string to number conversion ('aaa'.to_f returns 0.0, thus is valid)
|
112
|
+
# this method is also implemented for all other classes, such as Integer, Float, NilClass, TrueClass, Hash and so on...
|
112
113
|
|
113
114
|
is_nan?
|
114
115
|
# returns true if a string does NOT match the Rubinius source code regex for strings and integers, false otherwise
|
115
116
|
# comes in handy since ruby plays it safe on string to number conversion ('aaa'.to_f returns 0.0, thus is valid)
|
117
|
+
# this method is also implemented for all other classes, such as Integer, Float, NilClass, TrueClass, Hash and so on...
|
116
118
|
```
|
117
119
|
|
118
120
|
|
@@ -13,4 +13,84 @@ class String
|
|
13
13
|
!is_nan?
|
14
14
|
end
|
15
15
|
|
16
|
-
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Descending classes which are always numeric
|
19
|
+
|
20
|
+
class Numeric
|
21
|
+
|
22
|
+
def is_nan?
|
23
|
+
false
|
24
|
+
end
|
25
|
+
|
26
|
+
def is_num?
|
27
|
+
true
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
# Classes which are never numeric
|
33
|
+
|
34
|
+
class NilClass
|
35
|
+
|
36
|
+
def is_nan?
|
37
|
+
true
|
38
|
+
end
|
39
|
+
|
40
|
+
def is_num?
|
41
|
+
false
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
class TrueClass
|
48
|
+
|
49
|
+
def is_nan?
|
50
|
+
true
|
51
|
+
end
|
52
|
+
|
53
|
+
def is_num?
|
54
|
+
false
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
class FalseClass
|
61
|
+
|
62
|
+
def is_nan?
|
63
|
+
true
|
64
|
+
end
|
65
|
+
|
66
|
+
def is_num?
|
67
|
+
false
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
class Hash
|
74
|
+
|
75
|
+
def is_nan?
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
def is_num?
|
80
|
+
false
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
class Array
|
87
|
+
|
88
|
+
def is_nan?
|
89
|
+
true
|
90
|
+
end
|
91
|
+
|
92
|
+
def is_num?
|
93
|
+
false
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
data/lib/eitil/version.rb
CHANGED