Class: Numeric

Inherits:
Object show all
Defined in:
lib/marfa/helpers/classes/numeric.rb

Overview

Additional Numeric functionality

Instance Method Summary collapse

Instance Method Details

#blank?true, false

Check if digit is blank 0.blank? => true 1.blank? => false

Returns:

  • (true, false)


15
16
17
18
# File 'lib/marfa/helpers/classes/numeric.rb', line 15

def blank?
  return true if zero?
  false
end

#present?true, false

Object isn’t blank

Returns:

  • (true, false)


22
23
24
# File 'lib/marfa/helpers/classes/numeric.rb', line 22

def present?
  !blank?
end

#to_price!String

Convert numeric price to string price with preferred view

Examples:

1042.42.to_price!

Returns:



7
8
9
# File 'lib/marfa/helpers/classes/numeric.rb', line 7

def to_price!
  self.to_s.to_price!
end