class Parxer::Formatter::Number

Public Instance Methods

format_value(v) click to toggle source
# File lib/parxer/formatters/number_formatter.rb, line 4
def format_value(v)
  v = integer? ? v.to_i : v.to_f
  v = v.round(round) if round?
  v
end

Private Instance Methods

integer?() click to toggle source
# File lib/parxer/formatters/number_formatter.rb, line 12
def integer?
  !!config[:integer]
end
round() click to toggle source
# File lib/parxer/formatters/number_formatter.rb, line 20
def round
  config[:round].to_s.to_i
end
round?() click to toggle source
# File lib/parxer/formatters/number_formatter.rb, line 16
def round?
  !integer? && !!config[:round]
end