Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/overwrite.rb
Instance Method Summary collapse
-
#blank? ⇒ TrueClass, FalseClass
An object is blank if it’s false, empty, or a whitespace string.
-
#dimension ⇒ Fixnum
Returns dimension of nested arrays.
-
#numeric? ⇒ TrueClass, FalseClass
Is it a numeric object.
Instance Method Details
#blank? ⇒ TrueClass, FalseClass
An object is blank if it’s false, empty, or a whitespace string. For example, “”, “ ”, nil
, [], and {} are all blank.
6 7 8 |
# File 'lib/overwrite.rb', line 6 def blank? respond_to?(:empty?) ? empty? : !self end |
#dimension ⇒ Fixnum
Returns dimension of nested arrays
18 19 20 |
# File 'lib/overwrite.rb', line 18 def dimension self.class == Array ? 1 + self[0].dimension : 0 end |
#numeric? ⇒ TrueClass, FalseClass
Is it a numeric object
12 13 14 |
# File 'lib/overwrite.rb', line 12 def numeric? true if Float(self) rescue false end |