-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add Decorator to my object #2
Conversation
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.
Hi Benjamin,
Good job so far!
There are some issues that you still need to work on to go to the next project but you are almost there!
Highlights
- linters are passing
Required Changes ♻️
Check the comments under the review.
Optional suggestions
Every comment with the [OPTIONAL] prefix is not crucial enough to stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better.
Cheers and Happy coding!👏👏👏
Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Please, remember to tag me in your question so I can receive the notification.
Please, do not open a new Pull Request for re-reviews. You should use the same Pull Request submitted for the first review, either valid or invalid unless it is requested otherwise.
As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.
person.rb
Outdated
def initialize(name) | ||
@nameable = name | ||
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.
- no need to include the initialize method in this class because there are not instance variables used
person.rb
Outdated
class Decorator < Nameable | ||
def initialize(nameable) | ||
@nameable = nameable | ||
super | ||
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.
- the attribute accessor should be created for the
@nameable
instance variable.
person.rb
Outdated
def correct_name | ||
@nameable | ||
end | ||
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.
- the
correct_name
method should return the result of thecorrect_name
method of the@namable
, which will look something like:
def correct_name
@nameable.correct_name
end
person.rb
Outdated
end | ||
|
||
def correct_name | ||
return @nameable.correct_name.slice(0, 10) if @nameable.correct_name.length > 10 |
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.
- this method should return the first 10 characters of the
#nameable
variable however your code is returning the first 11.
person.rb
Outdated
def initialize(nameable) | ||
@nameable = nameable | ||
super | ||
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.
- it is not necessary to use the initialize method in each class.
person.rb
Outdated
class TrimmerDecorator < Decorator | ||
def initialize(nameable) | ||
@nameable = nameable | ||
super | ||
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.
- it is not necessary to use the initialize method in each class.
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.
Hi @iambenkis,
Your project is complete! There is nothing else to say other than... it's time to merge it
Congratulations! 🎉
Highlights
- Good project setup ✔️
- No linters errors ✔️
Optional suggestions
Every comment with the [OPTIONAL] prefix won't stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better. Some of them were simply missed by the previous reviewer and addressing them will really improve your application.
Cheers and Happy coding!👏👏👏
Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Please, remember to tag me (@codecaiine) in your question so I can receive the notification.
As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.
App name : School Library
In this initial step, I implement the classes to represent students and teachers.
Checklist 🥇
Person
class create ✔️Student
class create ✔️Teacher
class create ✔️Nameable
class create (Interface) ✔️Person
class toNameable
✔️Decorator
base class prepared ✔️CapitalizeDecorator
andTrimmerDecorator
prepared ✔️Happy reviewing 👍