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
134 135 136 137 138 139 140 141 |
# 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 |
Instance Method Details
#<=>(other) ⇒ Object
124 125 126 127 128 129 130 131 132 |
# 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? ⇒ Boolean
120 121 122 |
# File 'lib/rbbt/rest/common/table.rb', line 120 def invalid? self == "NA" or self == "NaN" end |
#to_s ⇒ Object
143 144 145 |
# File 'lib/rbbt/rest/common/table.rb', line 143 def to_s self.invalid? ? self : "%.5g" % self.to_f end |