Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/ext/object.rb
Overview
Extends Object with additional helper methods
Instance Method Summary collapse
-
#blank? ⇒ true, false
Adds blank? method to any object Lifted from: github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/object/blank.rb.
-
#greater_than_zero? ⇒ true, false
Checks where object is greater than zero Returns false of object is nil.
Instance Method Details
#blank? ⇒ true, false
Adds blank? method to any object Lifted from: github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/object/blank.rb
6 7 8 9 10 |
# File 'lib/ext/object.rb', line 6 def blank? # rubocop:disable Style/DoubleNegation respond_to?(:empty?) ? !!empty? : !self # rubocop:enable Style/DoubleNegation end |
#greater_than_zero? ⇒ true, false
Checks where object is greater than zero Returns false of object is nil
15 16 17 18 |
# File 'lib/ext/object.rb', line 15 def greater_than_zero? return false if nil? to_i.positive? end |