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

let pick accept proc with single argument #18

Closed
wants to merge 1 commit into from
Closed

Conversation

dvee
Copy link
Contributor

@dvee dvee commented Feb 7, 2016

The documentation for pick suggests that a proc accepting just the file list as a parameter can be used (https://github.com/avit/stockboy/blob/master/lib/stockboy/provider.rb#L183 , https://github.com/avit/stockboy/blob/master/lib/stockboy/providers/ftp.rb#L22). However reduce requires a proc taking two arguments.

Suggested change conforms to examples in docs and shouldn't break existing usage.

@avit
Copy link
Owner

avit commented Feb 13, 2016

I'm a little concerned that this would behave differently based on the block arity (which can be a bit strange in ruby with *splat arguments: proc { |a, *b| }.arity == -2) but maybe that's unwarranted...

It looks like that pick ->(list) { documentation is just wrong anyway, it should just work with a standard reduce like this:

https://github.com/dvee/stockboy/blob/fix_pick/lib/stockboy/provider.rb#L155

Your point makes sense though, there might be room for improvement, let me know what you're trying to accomplish if reduce can't do it.

@avit
Copy link
Owner

avit commented Feb 13, 2016

See also: #1 if it's specifically about FTP.

@avit avit mentioned this pull request Sep 24, 2017
@avit avit closed this in #22 Sep 24, 2017
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