-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix error -- cast from Array(String) to String #895
Conversation
``` cast from Array(String) to String failed ``` Fixes luckyframework#884.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this on. One thing I'd like to see would be a spec that allows me to pass in an array value, and then one with a mixed value. So like...
it "should work" do
params = Avram::Params.new({"key" => ["val1", "val2"]})
SomeOperation.create(params) do |o, v|
v.should_not be_nil
end
end
it "should also work" do
params = Avram::Params.new({"key" => ["val1", "val2"], "key2" => "123"})
SomeOperation.create(params) do |o, v|
v.should_not be_nil
end
end
I think having those two test cases, we should be solid enough to know this all works well.
@hash : Hash(String, Array(String) | String) | \ | ||
Hash(String, Array(String)) | \ | ||
Hash(String, String) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, interesting! I think this is where I got tripped up before. I didn't think to also do a union of each one. Nice 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet! I think this looks good.
Fixes #884
You can now instantiate
Avram::Params
passing a hash with array values or string values or a mixture of both.