dtao / safe_yaml

Parse YAML safely
MIT License
217 stars 63 forks source link

[bugfix] Substitute _ for decimal values #51

Closed gjtorikian closed 10 years ago

gjtorikian commented 10 years ago

This fixes a bug with the ToInteger#transform? implementation.

Suppose you have a key:value pair of wordpress_id: 850_. Integer(value.gsub(",", "")) causes an ArgumentError, because the _ is not stripped away.

Right now we're checking if the first matcher--the decimal value--has an _ and getting rid of it. We can't just parse the _ away, because binary values (/\A0b[01_]+\Z) still need it.

dtao commented 10 years ago

Good call, thanks!

gjtorikian commented 10 years ago

Any chance for a new gem release for this? :heart:

dtao commented 10 years ago

Yeah, I think it's about time for SafeYAML 1.0. The API hasn't changed in a while and real-world use is going strong. I'll try to get it out later today.

gjtorikian commented 10 years ago

:christmas_tree:

dtao commented 10 years ago

Clearly by "later today" I meant "in two days" :)

gjtorikian commented 10 years ago

:heart: nonetheless.