solnic / virtus

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

String -> Integer coercion doesn't work for E notation #126

Closed greyblake closed 11 years ago

greyblake commented 11 years ago

Just noticed:

require "virtus"

class Test
  include Virtus

  attribute :num, Integer
end

t = Test.new
t.num = "1e3"
puts t.num.inspect

Output:

"1e3"

Expected:

1000

It likely requires update of FRACTIONAL_REGEXP

greyblake commented 11 years ago

I fixed it. But Github lost my commits. Hope they will be processed and appear later.

dkubb commented 11 years ago

I believe this is fixed in edge virtus. Please reopen if that is not the case.

greyblake commented 11 years ago

Yes, It's fixed in https://github.com/solnic/virtus/pull/127 Thanks.