Skip to content

Rubyの課題を作成しました - #2

Open
busitora wants to merge 8 commits into
masterfrom
topic-exercise02
Open

Rubyの課題を作成しました#2
busitora wants to merge 8 commits into
masterfrom
topic-exercise02

Conversation

@busitora

@busitora busitora commented Mar 5, 2019

Copy link
Copy Markdown
Owner

exercise02-1
@speedが30以上50未満時アラートを出力、50以上のときはアラート後、減速する仕様です。

exercise02-2
Carクラスを継承したTrackCarクラスでload_weightというアクセサメソッド(ゲッター)を追加しインスタンス生成時はデフォルトでload_weightが500になる仕様です。

exercise02-3
Carクラスにpassengersというアクセサメソッド(ゲッター/セッター)を追加し初期値を1として、passengersが1ずつ増えていき最大4人でpassengersは増えない仕様です。

exercise02-4
Carクラスにcount_infoというクラスメソッドを追加しクラス変数@@countが表示される仕様です。

exercise02-5
Animalクラスを継承したDogクラス、Catクラスでそれぞれのクラスで初期値として設定されている@voiceを書き換えました。

@hiroki-okazaki

Copy link
Copy Markdown

superやputs内に変数を使ったりと全体的に良いと思いました!
LGTM!

@busitora

busitora commented Mar 7, 2019

Copy link
Copy Markdown
Owner Author

superやputs内に変数を使ったりと全体的に良いと思いました!
LGTM!

@busitora busitora closed this Mar 7, 2019
@busitora busitora reopened this Mar 7, 2019

@koooosuke koooosuke left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

commit粒度はわかりやすくて良いです!!
いくつか気になったのでコメントしました!ご確認下さい!

Comment thread animal.rb
class Dog < Animal
def initialize(name)
super
@voice = "ワンワン"

@koooosuke koooosuke Mar 8, 2019

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

細かいですが、課題2-5の出力が相違しているのでご確認下さい。

$ ruby exercise02-5.rb
わんこ: ワンワン!
にゃんこ: ニャー!

Comment thread car.rb
def self.count_info
"Carクラスのクラス変数@@countは#{@@count}です。"
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ここの2行の空白は1行にするか、なくてもいいかなと思います!

Comment thread animal.rb
end No newline at end of file
end

class Dog < Animal

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

class Dog < Animal
ここのインデントはしなくてもいいかなと個人的には思います!

Comment thread animal.rb
end
end

class Cat < Animal

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ここも同じくインデントしなくてもいいかなと思います!

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.

3 participants