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
Decorate a class #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 @anagudelogu 👋,
Good job so far!
Highlights
- All linters checks passed 💯
- Created Nameable class 💯
- Created BaseDecorator class 💯
However, there are some issues that you still need to work on to go to the next project but you are almost there!
Required Changes ♻️
Kindly 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.
You can also consider the optional suggestions I made in the comments under the review. 👍
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.
def initialize(nameable) | ||
super() |
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.
- [Optional] You do not need to call the
super
method here because theNameable
class doesn't have an initialize method (constructor). 👍
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 @Gambit142! thank you for your review, I had to add super
because it throws an offense in rubocop if not added.
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 @anagudelogu, It is alright, I forgot there has been a debate on this issue since the year 2020. 😄 You can get the full story here
lib/person.rb
Outdated
require_relative './capitalize_decorator' | ||
require_relative './trimmer_decorator' | ||
|
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.
- Kindly remove these statements here. When I try to create a Person object in other files to test your code, I get errors due to these lines of code. Remember that the only class you need to import in the
person.rb
file is theNameable
class. Kindly implement this change. 👍
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.
@Gambit142 Sure, I tested the functionality and forgot to remove those, thank you for your feedback!
attr_reader :id | ||
attr_accessor :name, :age | ||
|
||
def initialize(age, name = 'Unknown', parent_permission: true) | ||
super() |
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.
- [Optional] You do not need to call the
super
method here because theNameable
class doesn't have an initialize method (constructor). 👍
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.
Approved ✔
Hi @anagudelogu,
Great job, Your project is complete! There is nothing else to say other than... it's time to merge it
Congratulations! 🎉
(Highlights) Good Points: 👍
- You documented your work professionally. ✔
- Github flow is used correctly. ✔
- All linters checks are ok. ✔
(Changes Required) Aspects to improve: ♻️
- N/A
[Optional] suggestions:
- N/A
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, and 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.
In this Milestone I:
Created a class
Nameable
.correct_name
that will raise aNotImplementedError
.Turned my Person class to
Nameable
.correct_name
that returns the name attributeCreated
Base Decorator
.nameable
object and stores it in an instance variable.correct_name
method that returns the result of thecorrect_name
method of the@nameable
.Created CapitalizeDecorator.
correct_name
that capitalizes the output of@nameable.correct_name
.Created TrimmerDecorator
correct_name
that ensures that the output of@nameable.correct_name
has 10 characters. If it's longer it should trim the word.I would appreciate any optional comments and feedback about the code in general, this helps me improve my skills and write clean code that follows professional standards. 🤓