I would like to be able to identify what the name of the method is from the method which is currently being called. I have tried the following:
#!/usr/bin/env ruby
class SomeClass
def initialize
puts self.name
end
end
p = SomeClass.new
but receive the following error:
./test.rb:4:in `initialize': undefined method `name' <SomeClass:0x007fe4d107ba30 (NoMethodError)
from ./test.rb:7:in `new'
from ./test.rb:7:in `<main>'
How do I call the method I am calling from?