Module: NumericValue

Extended by:
Entity
Defined in:
lib/rbbt/rest/common/table.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.tsv_sort(v) ⇒ Object



55
56
57
58
59
60
61
62
# File 'lib/rbbt/rest/common/table.rb', line 55

def self.tsv_sort(v)
  value = v.last
  if Array === value
    value.first.to_f
  else
    value.to_f
  end
end

Instance Method Details

#<=>(other) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/rbbt/rest/common/table.rb', line 47

def <=>(other)
  if Float === self
    super(other.to_f)
  else
    self.to_f <=> other.to_f
  end
end

#to_sObject



64
65
66
# File 'lib/rbbt/rest/common/table.rb', line 64

def to_s
  "%.5g" % self.to_f
end