class Quandl::Operation::Value

Public Class Methods

precision(data, prec = 14) click to toggle source

rubocop:disable Style/FormatString

# File lib/quandl/operation/value.rb, line 6
def precision(data, prec = 14)
  r = []
  data.each do |row|
    new_row = [row[0]]
    row[1..-1].each do |v|
      new_row << ((v.nil? || v == Float::INFINITY) ? v : Float("%.#{prec}g" % v))
    end
    r << new_row
  end
  r
end