gorillib 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/gorillib.gemspec +1 -1
- data/lib/gorillib/object/blank.rb +13 -6
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/gorillib.gemspec
CHANGED
@@ -8,10 +8,22 @@ class Object
|
|
8
8
|
#
|
9
9
|
# @return [TrueClass, FalseClass]
|
10
10
|
#
|
11
|
-
# @api public
|
12
11
|
def blank?
|
13
12
|
nil? || (respond_to?(:empty?) && empty?)
|
14
13
|
end
|
14
|
+
|
15
|
+
##
|
16
|
+
# Returns true if the object is NOT nil or empty
|
17
|
+
#
|
18
|
+
# [].present? #=> false
|
19
|
+
# [1].present? #=> true
|
20
|
+
# [nil].present? #=> true
|
21
|
+
#
|
22
|
+
# @return [TrueClass, FalseClass]
|
23
|
+
#
|
24
|
+
def present?
|
25
|
+
not blank?
|
26
|
+
end
|
15
27
|
end # class Object
|
16
28
|
|
17
29
|
class Numeric
|
@@ -24,7 +36,6 @@ class Numeric
|
|
24
36
|
#
|
25
37
|
# @return [FalseClass]
|
26
38
|
#
|
27
|
-
# @api public
|
28
39
|
def blank?
|
29
40
|
false
|
30
41
|
end
|
@@ -38,7 +49,6 @@ class NilClass
|
|
38
49
|
#
|
39
50
|
# @return [TrueClass]
|
40
51
|
#
|
41
|
-
# @api public
|
42
52
|
def blank?
|
43
53
|
true
|
44
54
|
end
|
@@ -52,7 +62,6 @@ class TrueClass
|
|
52
62
|
#
|
53
63
|
# @return [FalseClass]
|
54
64
|
#
|
55
|
-
# @api public
|
56
65
|
def blank?
|
57
66
|
false
|
58
67
|
end
|
@@ -66,7 +75,6 @@ class FalseClass
|
|
66
75
|
#
|
67
76
|
# @return [TrueClass]
|
68
77
|
#
|
69
|
-
# @api public
|
70
78
|
def blank?
|
71
79
|
true
|
72
80
|
end
|
@@ -82,7 +90,6 @@ class String
|
|
82
90
|
#
|
83
91
|
# @return [TrueClass, FalseClass]
|
84
92
|
#
|
85
|
-
# @api public
|
86
93
|
def blank?
|
87
94
|
strip.empty?
|
88
95
|
end
|