Problem
# Example ImmutableStruct
Example = ImmutableStruct.new([:name])
Example.new(name: "somestring")
# => NoMethodError (undefined method `to_a' for "somestring":String)
Potential solution:
Check if we can call #to_a on the object that we are receiving. If we cannot, continue to fail but provide a more helpful message around what failed and how to fix it. Proposed language:
Expected Array for property: :name, Got: String
This one maintains the current API and behavior.
Alternative solution
Instead of using Object#to_a use Array(Object) which will wrap the object in an array or no-op if it's already an array.