Age | Commit message (Collapse) | Author |
|
* use Float() to process string arguments
* get rid of doubly nested arrays
* removing needless ternary operator
* improving error message handling
|
|
This is a bit more heavy-handed than I might like, but it does appear to
do the right things:
* accepts numeric input appropriately, truncating floats
* matches string input against a regex, then coerces number-looking
strings to int
* makes a best effort to coerce anything else to a string, then subjects
it to the same treatment
* raises an error in the event of incorrect number of arguments or
non-number-looking strings
I've also included some additional unit tests.
|
|
No more coercing to String and regex matching. Instead, we now coerce
to Integer at the beginning or raise an error if we cannot coerce to
Integer.
A consequence of this change is that the function will now accept
blatantly non-numeric strings as input, and return false. This seems a
bit goofy to me, but it's how String#to_i works. If we really don't
like this, then I'm open to suggestions.
|
|
Also ignore rspec fixtures directory
|
|
|
|
|