Closed changeclay closed 11 years ago
@changeclay I tried to replicate your error with this
https://gist.github.com/cored/5768920
But couldn't am I missing something?
require 'virtus'
class Apple
include Virtus::ValueObject
attribute :metrics, Hash[String => Integer]
end
ruby virtus_test.rb
ArgumentError: more than one [key => value] pair in `{String=>Integer, :writer=>:private}`
Thanks I will try to figure this out :-)
I'm guessing there's somewhere in the code that processes the arguments passed into #attribute
that assumes the last argument is a Hash of options, when it really is the type, and then it mixes in some defaults into what it thinks are "options". Some validation code then blows up when it checks the type.
E.g. using
When I initialize, I get: