if condition based on method calling

Look into the 'caller' method (http://corelib.rubyonrails.org/classes/Kernel.html#M002048).

def method3   from = (caller[0].match(/in `(.*?)'/) || )[1]   puts "called from #{from}" end