class Symbol
def %(arg)
...
end
endThe above code does what you need, but leaves no hint that you've made a change to Symbol. An alternative solution is to define a module and include that module in Symbol.module SymbolExtension
def %(arg)
...
end
end
Symbol.send :include, SymbolExtensionGranted, this isn't a huge hint, but if you check
Symbol.ancestors you'll find the following list.Symbol SymbolExtension Object Kernel
extracted from: http://blog.jayfields.com/2007/01/class-reopening-hints.html
No comments:
Post a Comment