-
Notifications
You must be signed in to change notification settings - Fork 6
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
亀田の回答 #1
base: master
Are you sure you want to change the base?
Conversation
# -*- encoding: utf-8 -*- | ||
|
||
|
||
class Codebreaker |
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.
ネームスペースとして使うなら module
の方が向いているように思います。(他に理由があったらごめんなさい。)
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.
確かにそうかも!
僕は特にこだわりなく、クラスにしてしまいます。
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.
なんとなくRuby界隈ではネームスペースにmoduleを使う文化があるように思うのですが、この辺りは好みなのかもですね。
real_hit_count = total_hit_count - match_count で求めるようにした。
total_hit_countを書きなおした
ひどい感じだったところを書き直しました。
|
👍 |
|
||
module Enumerable | ||
def sum | ||
self.inject(0) {|memo,i| memo + i} |
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.
無駄知識ですが、以下で同じ意味です。
inject(:+)
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.
これはオシャレ かつ 便利!
回答書きました。レビューお願いします!