Issue #13383 has been updated by wanabe (_ wanabe). sorah (Sorah Fukumori) wrote: > it would be happier if we can get all of source locations where a class opened? I hope Module#source_locations, too. Like below: ``` # Just a PoC class Module attr_reader :source_locations end TracePoint.new(:class) do |tp| tp.self.module_eval do @source_locations ||= [] @source_locations << [tp.path, tp.lineno] end end.enable class Foo end class Foo end p Foo.source_locations #=> [["a.rb", 13], ["a.rb", 15]] ``` ---------------------------------------- Feature #13383: [PATCH] Module#source_location https://bugs.ruby-lang.org/issues/13383#change-64854 * Author: koba789 (Hidekazu Kobayashi) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- # Abstract It can inspect where the module or class is defined. # Background In debugging or development an application, I usually want to find out where the class definition of using library. There is Method#source_location but I could not find **Class** easily. # Implementation In Github: https://github.com/ruby/ruby/pull/1562 -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>