Skip to content
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

allow hash arguments #22

Merged
merged 3 commits into from
Sep 17, 2015
Merged

Conversation

takkanm
Copy link
Contributor

@takkanm takkanm commented Sep 15, 2015

test all combinations of values.

You can be described as follows.

# use Traditional 

where(:a, :b, :c) do
  [[1, 5, 2], [1, 5, 4], [1, 7, 2], [1, 7, 4], [1, 9, 2], [1, 9, 4], [3, 5, 2], [3, 5, 4], [3, 7, 2], [3, 7, 4], [3, 9, 2], [3, 9, 4]]
end

# use Hash argument
 where(a: [1, 3], b: [5, 7, 9], c: [2, 4])

test all combinations of values
@@ -38,7 +38,17 @@ def initialize(arg_names, table_format, &block)
# end
#
def where(*args, &b)
set_parameters(args, false, &b)

if args.size == 1 && (params = args[0]).instance_of?(Hash)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(params = args[0]).instance_of?(Hash) is not reader friendly.
params assignment should be in if block

@takkanm
Copy link
Contributor Author

takkanm commented Sep 17, 2015

I fix it.

@joker1007
Copy link
Collaborator

Thanks!!

joker1007 added a commit that referenced this pull request Sep 17, 2015
@joker1007 joker1007 merged commit 92344e1 into tomykaira:master Sep 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants