I am still new to Ruby and basically just writing my first micro-program after finishing Cooper's book. I was pointed to the direction of avoiding monkey patching but the problem is I don't know what are the alternatives to achieve the same behavior. Basically, I want to add a new method that is accessible by every string object. The obvious monkey-patching way is to:
class String
def do_magic
...magic...
end
end
I recall there's a way using String.send. But I can't remember how it's done nor where I read it. Can anyone point out any alternatives that would still let me make that method available to the String class and child objects?