Ad
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Yeah, that confused me for a while. I just directly followed the examples

  • Custom User Avatar

    That's just sementic difference ;-)

  • Default User Avatar

    In Javascript one doesn't "reopen a class", but simply adds a new symbol to an object or it's prototype.

  • Custom User Avatar

    I'd say so, except it might be clear for JS to say "add a new method to the String object".

  • Custom User Avatar

    I've changed the description, is it better now?

  • Custom User Avatar

    This description isn't clear.

  • Default User Avatar

    Ruby version of Kata should ideally include random tests, keep that in mind when authoring future Kata :)

  • Custom User Avatar

    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.

  • Default User Avatar

    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.

  • Custom User Avatar

    Maybe I'm mistaken... but isn't it still monkey patching to reopen the class and alias a method?

  • Default User Avatar

    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.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Test cases check if your method return proper value, so you should add proper keyword :)

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Loading more items...