module NumericValue

Public Class Methods

tsv_sort(v) click to toggle source
# File lib/rbbt/rest/common/table.rb, line 134
def self.tsv_sort(v)
  value = v.last
  if Array === value
    value.first.to_f
  else
    value.to_f
  end
end

Public Instance Methods

<=>(other) click to toggle source
Calls superclass method
# File lib/rbbt/rest/common/table.rb, line 124
def <=>(other)
  if Float === self
    super(other.to_f)
  else
    v1 = self.to_f
    v2 = other.to_f
    v1 <=> v2
  end
end
invalid?() click to toggle source
# File lib/rbbt/rest/common/table.rb, line 120
def invalid?
  self == "NA" or self == "NaN"
end
to_s() click to toggle source
# File lib/rbbt/rest/common/table.rb, line 143
def to_s
  self.invalid? ? self : "%.5g" % self.to_f
end