class Functio::FormattedNum

Represents a number using a default format.

Public Class Methods

new(num_obj) click to toggle source

Creates a FormattedNum instance from a num_obj.

# File lib/functio/formatted_num.rb, line 24
def initialize(num_obj)
  @num = num_obj
end

Public Instance Methods

to_s() click to toggle source

Converts the FormattedNum to a String. The String is formatted using conventional floating point notation if the number is a float.

# File lib/functio/formatted_num.rb, line 30
def to_s
  case @num
  when BigDecimal
    @num.to_s('F')
  else
    @num.to_s
  end
end