I’d like to know the current method name or alias used, as follows:
m = method
flag = (m == “write!” ? true : false)
some processing based on flag
alias :write! write
So if user calls write! flag is true, else false.
method gives original name not alias used.
In irb, i tried: caller =~ /`([^’]*)’/ and $1
but this returns “irb_binding”.
I might land up having quite a lot of such methods, so i’d rather not
make multiple methods with “!” calling the original ones.
(btw, i’ve checked earlier threads: