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

initial commit #56

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

initial commit #56

wants to merge 1 commit into from

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