Conversation
added 2 commits
February 8, 2022 15:34
yuuu
reviewed
Feb 14, 2022
06.wc/wc.rb
Outdated
There was a problem hiding this comment.
06.wc/wc.rb
Outdated
There was a problem hiding this comment.
if側とelse側で count_lines が重複しているので、書き方を変えることで重複を無くせないか検討をお願いします。puts で一気に出力するのではなく、 print で部分的に出力すると良さそうですね。
Owner
Author
There was a problem hiding this comment.
count_lines をif文の前に出せばいけそうです!
ありがとうございます!
added 2 commits
February 17, 2022 12:32
yuuu
reviewed
Feb 17, 2022
06.wc/wc.rb
Outdated
There was a problem hiding this comment.
ここも行の出力部分がifとelseで重複していますね。
ファイルの情報の出力処理とコードを共通化できると修正する箇所も1箇所で済むかもしれませんね。
06.wc/wc.rb
Outdated
yuuu
reviewed
Mar 1, 2022
| words_count = cal_words_count(File.read(file)) | ||
| bytes_count = File.size(file) | ||
|
|
||
| print lines_count |
There was a problem hiding this comment.
名前 行数 単語数 文字数 オプション という4つの情報を引数にとって、オプションに応じて出力するメソッドがあると、以下3箇所のコードをメソッドに集約できそうですね 👍
- https://github.com/naganosinya/ruby-practices/pull/9/files#diff-eee0d2e019552fc9da3ca5528607acddb2f4796279c350d0a65842fed78976cbR25
- https://github.com/naganosinya/ruby-practices/pull/9/files#diff-eee0d2e019552fc9da3ca5528607acddb2f4796279c350d0a65842fed78976cbR47
- https://github.com/naganosinya/ruby-practices/pull/9/files#diff-eee0d2e019552fc9da3ca5528607acddb2f4796279c350d0a65842fed78976cbR55
ぜひ検討してみてください🙏
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.