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

Simpeler recurring pushers #4

Merged
merged 2 commits into from
Nov 23, 2018
Merged

Simpeler recurring pushers #4

merged 2 commits into from
Nov 23, 2018

Conversation

dim
Copy link
Member

@dim dim commented Nov 23, 2018

iterator = relation.respond_to?(:find_each) ? :find_each : :each
relation.send(iterator) {|rec| stream.write(rec) }
iterator = enum.respond_to?(:find_each) ? :find_each : :each
enum.send(iterator) {|rec| stream.write(rec) }
Copy link
Contributor

Choose a reason for hiding this comment

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

There's no caching for def enum, it'll be resolved twice here.
I'd suggest to somehow cache self.enum value to be more consistent.

Copy link
Member Author

Choose a reason for hiding this comment

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

it's cached, it's not using self.enum but the passed argument, I can make it nicer by renaming it though

@mxmCherry
Copy link
Contributor

@dim looks nice, though I've noticed that write_enum would resolve enum twice.

@dim dim merged commit 6f37b07 into master Nov 23, 2018
@dim dim deleted the feature/recurring branch June 12, 2019 14:29
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