5 kyu

Split hash by key(s)

374 of 376OlgaGr
Description
Loading description...
Algorithms
  • Please sign in or sign up to leave a comment.
  • mjsspencer Avatar

    Great kata.

  • SomeGuy Avatar

    If hash does not contain at least one of the key given as an argument, method should raise an exception.

    Doesn't this contradict the last test case given? I was expecting to only have to raise an exception if there was no valid keys in the args, not if any single one of the args was an invalid key.

    • hh9 Avatar

      I had this problem too. Either the instructions or the test case needs to be fixed. Kata authors need to be aware that this makes their katas annoying and unenjoyable. Please be explicit about what you expect out of our code and be consistent in your test cases!!

    • OlgaGr Avatar

      The instruction says: 'If hash does not contain at least one of the key given as an argument, method should raise an exception.'. In the test I gave two keys: one is correct (it is present in the hash), the second is not present in the hash. So at least one of the given key is not present in the hash. I don't see error in the description. Do you think that description:

      'If any of the keys given as an argument is not present in the hash, the method should raise the an exception'.

      will be more clear?

      hh9 - it's really not so easy to create kata and make it clear for everyone. I see that you haven't create any yet. Please try and you will see :)

    • SomeGuy Avatar

      If any of the keys given as an argument is not present in the hash, the method should raise the an exception

      Yes, this is much clearer. Although these might be slightly better:

      If a key given as an argument is not present in the hash, the method should raise an exception

      or

      If any of the keys given in the argument are not present in the hash, the method should raise an exception

      Thanks for the response!

  • liptomek Avatar

    Cool kata, keep up the good work.

  • shkm Avatar

    This comment has been hidden.