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.
Usage of
length/1
there can be performance killer. Test against[]
instead as it will be much faster.It is waste of resources to go for full
2..integer
as if we know that ifn
dividesinteger
theninteger / n
divides it as well asa / b = c <=> a / c = b
. So instead of going for full range we can go up tosqrt(integer)
.Another thing is that turbofish operator in
collect
is completely unneeded as it can be deduced by the compilator from return type.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Usage of this method is rather similar to
#map
than#each
as we should return values returned by method not array.No need for square brackets.
Test should use
Test.assert_equal
instead ofTest.expect
because I have receiving very helpful message: "This is not expected". I feel really sorry for coworkers of author if he write all his/her tests like this.Of course it can. But why not use the most of rubiest ways and use already created lib for that (as it fullish all our expectations).
Why
require
doesn't work? I've trying to solve this using IPAddr (http://www.ruby-doc.org/stdlib-2.0.0/libdoc/ipaddr/rdoc/IPAddr.html) but it doesn't work.