Class: Object

Inherits:
BasicObject
Defined in:
lib/ext/object.rb

Overview

Extends Object with additional helper methods

Instance Method Summary collapse

Instance Method Details

#blank?true, false

Returns:

  • (true, false)


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

Returns:

  • (true, false)


15
16
17
18
# File 'lib/ext/object.rb', line 15

def greater_than_zero?
  return false if nil?
  to_i.positive?
end