Skip to content

Conversation

@carakane
Copy link

self.height += 1
end
self.age > 8 ? self.add_apples : false
self.dead? ? self.alive = false : self.alive = true
Copy link
Member

@mikegee mikegee May 14, 2018

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
Copy link
Member

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)) }

@mikegee
Copy link
Member

mikegee commented May 14, 2018

Looks really good to me!

expect(fuji.alive).to be(true)
end

it 'stops growing after it is 20 feet tall' do
Copy link
Member

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.

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