search for: __to_s__

Displaying 1 result from an estimated 1 matches for "__to_s__".

Did you mean: ___o____
2007 Feb 02
0
Fwd: [ mocha-Bugs-7834 ] infinte_range.rb makes incorrect assumption about to_f
...on about to_f Initial Comment: infinite_range.rb assumes that first and last elements of a Range respond to to_f: def to_s if first.to_f.infinite? then return "at most #{last}" elsif last.to_f.infinite? then return "at least #{first}" else __to_s__ end end This is incorrect - Ranges can include any objects that implement <=> and succ; converting objects to float values isn''t a safe assumption. (I hit this with a range of Date objects) The simple fix is to see if the object responds to to_f: def to_s...