-
Notifications
You must be signed in to change notification settings - Fork 74
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
finished challenge #69
base: master
Are you sure you want to change the base?
Conversation
self.height += 1 | ||
end | ||
self.age > 8 ? self.add_apples : false | ||
self.dead? ? self.alive = false : self.alive = true |
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.
Flipping this around is a bit simpler, I think:
self.alive = !self.dead?
end | ||
|
||
def add_apples | ||
3.times do self.apples << Apple.new("red", rand(2..4)) end |
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.
Rubyists tend to use curly braces for single-line blocks:
3.times { self.apples << Apple.new("red", rand(2..4)) }
Looks really good to me! |
expect(fuji.alive).to be(true) | ||
end | ||
|
||
it 'stops growing after it is 20 feet tall' do |
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.
looks good but keep in mind using context to clean it defs
like this and make them more readable.
@jaybobo