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
132 133 134 135 136 137 138 139 |
# File 'lib/rbbt/rest/common/table.rb', line 132 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
122 123 124 125 126 127 128 129 130 |
# File 'lib/rbbt/rest/common/table.rb', line 122 def <=>(other) if Float === self super(other.to_f) else v1 = self.to_f v2 = other.to_f v1 <=> v2 end end |
#invalid? ⇒ Boolean
118 119 120 |
# File 'lib/rbbt/rest/common/table.rb', line 118 def invalid? self == "NA" or self == "NaN" end |
#to_s ⇒ Object
141 142 143 |
# File 'lib/rbbt/rest/common/table.rb', line 141 def to_s self.invalid? ? self : "%.5g" % self.to_f end |