« Back to Index

Ruby: get class name and method name

View original Gist on GitHub

get.rb

class Foo
  def initialize
    p "#{self.class.name}##{__method__}"
  end
end

Foo.new # => Foo#initialize