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
That won't work if searchText contains special regexp characters, I believe.
2.0.0p353 :032 > searchText = "??"
2.0.0p353 :033 > Regexp.new("(?=(#{searchText}))")
RegexpError: undefined group option: /(?=(??))/
Don't feel bad :)
Agreed. I did it hardcoded, too, but then felt bad about it!
The test cases do not check for other keys than :a, :b so hardcoded solutoins unfortunatelly work.
I belive this shouldn't pass because it sums all values of keys :a, :b hardcoded, not the values of two passed keys to the function. Perhaps the Kata Test Cases should be improved?
I belive this shouldn't pass because it sums all values, not the values of two passed keys to the function. Perhaps the Kata Test Cases should be improved?
Good use of Regex. I put the test for length in the block.
a bit cryptic but interesting. I've never seen $& in action :)