I’m trying to complete the methods exercises and running into the following error:
`1) methods.rb int_remainder_without_modulo doesn’t use the % operator
Failure/Error: return (i_divisor * dec_remainder_of_two_integers(i_dividend, i_divisor)).round.to_i
TypeError: coerce must return [x, y] # ./lib/methods.rb:107:in `*' # ./lib/methods.rb:107:in `int_remainder_without_modulo' # ./spec/methods_spec.rb:144:in `block (3 levels) in <top (required)>'`
I’ve looked through other topics on this error but I haven’t been able to resolve it. My best understanding is that coerce is being called on an object, I assume what my method is returning, but that object can’t coerce, resulting in a typeError. The final method called on my return value is to_i, and from my poking around in documentation on coerce, integers should have the method. I can paste my code if needed but I’m not sure what the rules on that are.
To the best of my knowledge none of the methods called use modulo, including the dec_remainder_of_two_floats and dec_remainder_of_two_integers, but I do use the floor method. Does this use %1 and would that be enough to trip this final test? Is there a place where I can see the code being used in ruby’s built in methods?