No major issue, but the first example has a typo: "unflat = {id: 1, info: {name: 'example'}}.flattened_keys
unflat.flattened_keys # equals {id: 1, info_name: 'example'}"
flattened_keys is called twice on unflat. Maybe have it as "flat = {...}.flattened_keys .... flat # equals ..."
It doesn't specify how to specify the key either by string of symbol, they are just examples.
This shouldn't make a difference when creating a solution.
For the ruby translation:
In ruby, hash values are accessed by keys which are either symbols or strings. In the description it tells the warrior to use symbols, where in reality the problem uses strings, so:
Example of student Object: {"name" => 'Henry, Johns',"marks"=>[25,50]}
instead of
Example of student Object: {name:'Henry, Johns',marks:[25,50]}
And same with the expected output...Thanks!
I think you dont even need to work of this edge case.
"abc"[1...-1] # => "b"
"ac"[1...-1] # => ""
"a"[1...-1] # => ""
Thats the only one that may be a problem
""[1...-1] #=> nil
Random tests added
No major issue, but the first example has a typo: "unflat = {id: 1, info: {name: 'example'}}.flattened_keys
unflat.flattened_keys # equals {id: 1, info_name: 'example'}"
flattened_keys is called twice on unflat. Maybe have it as "flat = {...}.flattened_keys .... flat # equals ..."
nice and tidy with use of <<
It doesn't specify how to specify the key either by string of symbol, they are just examples.
This shouldn't make a difference when creating a solution.
This comment is hidden because it contains spoiler information about the solution
Cool Kata!
For the ruby translation:
In ruby, hash values are accessed by keys which are either symbols or strings. In the description it tells the warrior to use symbols, where in reality the problem uses strings, so:
Example of student Object: {"name" => 'Henry, Johns',"marks"=>[25,50]}
instead of
Example of student Object: {name:'Henry, Johns',marks:[25,50]}
And same with the expected output...Thanks!
http://www.codewars.com/dojo/katas/reviews/516f30297c907a79f2000638/groups/522f953c88d49dc761000093
string#chars is significantly faster than string#split as seen in this reply by danielaquino
There is a strange test case with a lone "?". The kata Description is not clear enough how to handle words that include punctuation.
"?" becomes "?"
But what about "How are you?" Should this become "owHay reaay ouyay?"
This comment is hidden because it contains spoiler information about the solution
as donald says. needs more than the 2 test cases from the description.