-1

I am trying to create a method that can be called by any class, similar to how .is_a? can be called by any class. How can one go about this?

I have tried using alias_method and Class.send(method) to achieve my result, but neither worked.

1 Answers1

0

Open the Object class and write your method there.

class Object 
  def your_method
  end
end

Now any class object can access this method.

Rajagopalan
  • 5,465
  • 2
  • 11
  • 29