Class: Quandl::Operation::Value
- Inherits:
-
Object
- Object
- Quandl::Operation::Value
- Defined in:
- lib/quandl/operation/value.rb
Class Method Summary collapse
-
.precision(data, prec = 14) ⇒ Object
rubocop:disable Style/FormatString.
Class Method Details
.precision(data, prec = 14) ⇒ Object
rubocop:disable Style/FormatString
6 7 8 9 10 11 12 13 14 15 16 |
# 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 |