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



65
66
67
68
69
70
71
72
# File 'lib/rbbt/rest/common/table.rb', line 65

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



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

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

#to_sObject



74
75
76
# File 'lib/rbbt/rest/common/table.rb', line 74

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