Skip to content

ShowSource of private method #577

@tompng

Description

@tompng

Description

When reading source code using show_source, I want to also look at private method definition.

class A
  def pub_foobar
    123
  end
  private def pri_foobar
    456
  end
end

a = A.new
binding.irb
irb(main):001:0> show_source A#pri_foobar
Error: Couldn't locate a definition for A#pri_foobar
=> nil
irb(main):002:0> show_source a.pri_foobar
Error: Couldn't locate a definition for a.pri_foobar
=> nil
irb(main):003:0> show_source A#pub_foobar

From: a.rb:2

  def pub_foobar
    123
  end

=> nil
irb(main):004:0> show_source a.pub_foobar

From: a.rb:2

  def pub_foobar
    123
  end

=> nil
irb(main):005:0> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions