coercible
coercible copied to clipboard
Establish sane default for nil conversions
When I was in the process of porting Virtus over to RubyMotion, I noticed a peculiarity that I hadn't noticed in previous versions where one could no longer instantiate an object without passing in attributes as well.
E.G.
class User
include Virtus
attribute :name, String
end
User.new #=> UnsupportedCoercion: Object#to_string doesn't know how to coerce nil.
The issue arose with the addition of this line of code. The line previously looked like this.
I don't mind handling this one if you give me a strategy. Implement a NilClass coercer that returns value
for every coercion method?
Same for me. Nothing changed?