How to determine the messages an object responds to (It's methods)

Hey, I am working on adding some tests to my projects and am having trouble setting up spies in Imba (1.5.3). I would like to have a spy that would record any calls made to any method which the object could handle, for example if I had the class:

class Arithmatic
  def multiply(a, b)
    a * b

  def divide(a,b)
    a / b

I would like to be able to keep track of calls to multiply and calls to divide with a single spy, something like:

let arithmatic = Arithmatic.new()
spyOn(arithmatic);

In Ruby, I can use the
instance_methods method (which is accessible on all objects, since all objects inherit from Object) to gather all methods-- utilizing this I can wrap methods utilizing the pattern:

for method in Arithmatic.instance_methods
  Arithmatic["method"] =
     ... # <- logging happens here
    method()

Is there any way to loop over the methods in an object in Imba?

You could look into using proxies and trap, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy