Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
Yeah, that confused me for a while. I just directly followed the examples
That's just sementic difference ;-)
In Javascript one doesn't "reopen a class", but simply adds a new symbol to an object or it's prototype.
I'd say so, except it might be clear for JS to say "add a new method to the String object".
I've changed the description, is it better now?
This description isn't clear.
Ruby version of Kata should ideally include random tests, keep that in mind when authoring future Kata :)
Why wouldn't you allow alias or
alias_method
. It's like you're trying to teach people how to do it the wrong way just to sate your desire to show how to reopen a class and define a method. The exercise could have been adjusted to require some additional behavior above just redirecting to an existing method wholesale.I'm going to say the same thing others have said...
I don't think it makes sense to disallow the use of alias_method if they aren't creating a unique method. This asks users to create an alias for a method while preventing them from using best practices. For newer programmers this could potentially teach them bad practices or confuse them on what the best practices are.
I recommend allowing the use of alias_method if the goal is to have users alias a method, or have them add a simple method like String#first or String#last to return the first or last character.
Maybe I'm mistaken... but isn't it still monkey patching to reopen the class and alias a method?
Apparently, as far as I can tell from reading comments on similar katas, this is valid and intended. The author's reasoning seems to be that these are supposed to be beginner's katas, intended to emphasize the importance of looking at the standard library.
This comment is hidden because it contains spoiler information about the solution
Test cases check if your method return proper value, so you should add proper keyword :)
This comment is hidden because it contains spoiler information about the solution
Loading more items...