Ruby 1.9 and NumericalString comparisons in case statements
-
Ben Klang
- State changed from open to fixcommitted
- Milestone set to 1.0.1
- Milestone order changed from 3034 to 0
for Ruby 1.9 users: The behavior of Ruby 1.9 and case statements has changed in a way that renders NumericalString objects incompatible with case statements. The suggested workaround is to cast the NumericalString to a string and then compare.
Example:obj = NumericalString.new("0987") case obj.to_s when "0987" then true else false endOr, if you need to ignore the leading zero:
case obj.to_i when 987 then true else false end -
Ben Klang
- Tag set to backward_incompatible, ruby19
-
Ben Klang
- State changed from fixcommitted to resolved
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.