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

Consistent method arguments #6

Open
jperry opened this issue May 3, 2013 · 5 comments
Open

Consistent method arguments #6

jperry opened this issue May 3, 2013 · 5 comments

Comments

@jperry
Copy link
Owner

jperry commented May 3, 2013

I wanted to start a conversation around consistent method arguments and get opinions on what flavor folks like best. I'll list a few to start, suggestions are welcome.

Any methods that only require one argument should be using a hash, see example

Hash parameters

method(id: 'value', param2: 'value')

single parameters

method(id, param2)

Parameters using blocks

method do |options|
  options.id = 'value'
  options.param2 = 'value'
end
@myanaros
Copy link

Sorry I was unclear, I meant just for building the request string to send to the get method. I totally agree that sending the complete hash to the method is appropriate.

@jperry
Copy link
Owner Author

jperry commented Jul 15, 2013

@myanaros - thanks for your response, I will probably review all places that aren't using the hash approach and convert them over, this will probably be a major version upgrade since it will break anyone using the old api. I may support both as a way to allow folks to migrate over. I hope this hasn't caused too much confusion =)

@myanaros
Copy link

It all makes sense, this gem has saved me more time than I can imagine. I look forward to the new version!

@jperry
Copy link
Owner Author

jperry commented Jul 15, 2013

Thanks, glad to hear the gem has been helping you out.

@jperry
Copy link
Owner Author

jperry commented Jul 15, 2013

@myanaros - Just released 0.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants