Module: Naught::InstanceMethods
- Defined in:
- lib/naught_check.rb
Instance Method Summary collapse
-
#aught? ⇒ Boolean
inverts naught?.
-
#naught? ⇒ Boolean
Tests if a value if nil, blank, or zero.
-
#nought? ⇒ Boolean
aliases .naught?.
-
#nowt? ⇒ Boolean
aliases .naught?.
-
#ought? ⇒ Boolean
aliases .aught?.
-
#owt? ⇒ Boolean
aliases .aught?.
Instance Method Details
#aught? ⇒ Boolean
inverts naught?
37 |
# File 'lib/naught_check.rb', line 37 def aught?; !naught?; end |
#naught? ⇒ Boolean
Tests if a value if nil, blank, or zero
nil.naught? => true
"".naught? => true
" ".naught? => true
[].naught? => true
{}.naught? => true
0.naught? => true
0.00.naught? => true
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/naught_check.rb', line 13 def naught? if self == nil true elsif self.kind_of? Array self.size == 0 elsif self.kind_of? Hash self.keys.size == 0 elsif self.kind_of? Numeric self.zero? elsif self.kind_of? String self == "" || (/^\s*$/.match(self) != nil) else false end end |
#nought? ⇒ Boolean
aliases .naught?
30 |
# File 'lib/naught_check.rb', line 30 def nought?; naught?; end |
#nowt? ⇒ Boolean
aliases .naught?
33 |
# File 'lib/naught_check.rb', line 33 def nowt?; naught?; end |
#ought? ⇒ Boolean
aliases .aught?
40 |
# File 'lib/naught_check.rb', line 40 def ought?; aught?; end |
#owt? ⇒ Boolean
aliases .aught?
43 |
# File 'lib/naught_check.rb', line 43 def owt?; aught?; end |