Class: ML_ruby::ML_float
- Defined in:
- lib/ml-ruby/ml_data_types.rb
Instance Method Summary collapse
-
#initialize(payload) ⇒ ML_float
constructor
A new instance of ML_float.
- #payload ⇒ Object
Methods inherited from ML_string
Methods inherited from ML_list
Constructor Details
#initialize(payload) ⇒ ML_float
Returns a new instance of ML_float.
105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/ml-ruby/ml_data_types.rb', line 105 def initialize payload # puts payload.inspect unless payload.is_a? Array if (payload*100).to_i % 10 == 0 payload= payload.to_s + "0" else payload= payload.to_s.gsub(/\.0/,'.') end end super payload end |
Instance Method Details
#payload ⇒ Object
116 117 118 |
# File 'lib/ml-ruby/ml_data_types.rb', line 116 def payload @payload.map {|c|c.payload}.join.gsub(/\.(\d)$/,'.0\1').to_f end |