Skip to content

Conversation

@robert-smith-07
Copy link

@jaybobo
@mikegee

I know the tests are terrible, any documentation, comments, resources are appreciated.

end

def add_apples
$i = 0
Copy link
Member

Choose a reason for hiding this comment

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

You may have intended to use a local variable here, but that $ prefix is making this a global instead. I think you can drop the $s in here.

end

def age!
@age += 1
Copy link
Member

Choose a reason for hiding this comment

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

The attr_reader at the top exposes @age, etc. by calling methods age.

This line is both reading and assigning age if you used attr_accessor, to define the setter methods too, this line could be age += 1.

I prefer depending on the methods as much as possible. Ruby will gladly return nil for a typoed instance variable, but raises an error for a typoed method name.

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.

2 participants