Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

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