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



115
116
117
118
119
120
121
122
# File 'lib/rbbt/rest/common/table.rb', line 115

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



107
108
109
110
111
112
113
# File 'lib/rbbt/rest/common/table.rb', line 107

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

#to_sObject



124
125
126
# File 'lib/rbbt/rest/common/table.rb', line 124

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