Closed mduvall closed 11 years ago
Next version will raise errors when it doesn't know how to coerce something. There's a discussion about it in issue #99 thread.
Re string numbers with leading zero, I guess we could follow ruby convention here.
The string issue would be awesome!
This issue is now resolved. The point @solnic mentions about raising errors when coercions are impossible is something separate. I'm going to mark this as resolved.
This may be myself not diving deep enough into the documentation - but is there a reason that non-significant type coercion for integers and floats does not coerce as Ruby does? (ie
Virtus::Coercion::String.to_integer('010')
returns'010'
while'010'.to_i'
returns10
as a Fixnum in Ruby.)This made it a little baffling in DataMapper where properties inherit Virtus coercion and Integers do not work as expected. Somebody else had also run into this issue: https://github.com/datamapper/dm-core/issues/228.
Should it be Virtus' responsibility to throw an exception or do the correct coercion? At the DataMapper layer this manifests itself as a silent failure... :-(