Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[review] each_with_progress メソッドを追加 #44
[review] each_with_progress メソッドを追加 #44
Changes from 1 commit
e378d76
8743ee9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
これがテストのDekiru::DummyRecordで失敗しないようにするためだけだとしたら、テストの方を直すほうが正攻法な気がしました。
あとでこれ読んでも何のための考慮か理解するのが難しそうだし、実際の利用上はまず必要のない分岐だろうなーと。
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.
@aki77
今までも find_each がないところで find_each を生やして使っている例があるんじゃないかと思って、テストを通すためもありますが互換性のためです。
仕様を
「target_scopeは『ブロック引数がなければenumeratorを返す』find_eachメソッドを持つ」
に変更するのであればテストもそのように変更しますがそれでいいですか?
(実際のところ分岐せず常に
target_scope.enum_for(:find_each)
としても問題なさそうですが)https://github.com/search?q=org%3ASonicGarden+find_each_with_progress&type=code
https://github.com/SonicGarden/planet-producttimes/blob/792fd05ff22880c4816e6aa59b20f540e8e1f8d3/scripts/lib/import_jicfs_codes.rb#L16
https://github.com/SonicGarden/aelz/blob/07bae8c1c1e5a57cf981ba652f788e92bf217a12/script/maintenance/20240206_import_tour_resources.rb#L9
ざっと探すと2例ですがどちらもenumeratorを返すので動作はしそう。
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.
なるほどー。
手動実行用のスクリプトでしか使わない処理だし、gemの更新案内見逃したとしてもエラーで落ちたら新しいメソッド使うように書き換えればいいだけなので、わざわざ古い仕様を維持する必要はないかなーと思いました。