solnic / virtus

[DISCONTINUED ] Attributes on Steroids for Plain Old Ruby Objects
MIT License
3.77k stars 229 forks source link

E notation coercion #127

Closed greyblake closed 11 years ago

greyblake commented 11 years ago

Changes for Issue #126

dkubb commented 11 years ago

This introduces one subtle bug where 'e1' is now coerced into 0.

dkubb commented 11 years ago

What I would think you'd want to do is something like:

FRACTIONAL_REGEXP = /(?:\.\d+)/.freeze
NUMERIC_REGEXP    = /\A(#{INTEGER_REGEXP}#{FRACTIONAL_REGEXP}?#{EXPONENT_REGEXP}?|#{FRACTIONAL_REGEXP}#{EXPONENT_REGEXP}?)\z/.freeze
greyblake commented 11 years ago

@dkubb You're right, thanks. Will fix today.

greyblake commented 11 years ago

Fixed in 0b753a8

dkubb commented 11 years ago

This looks great, thanks!