From: jeremy.phelps@... Date: 2017-06-25T09:08:19+00:00 Subject: [ruby-core:81765] [Ruby trunk Feature#10771] An easy way to get the source location of a constant Issue #10771 has been updated by jphelps (Jeremy Phelps). I've got a patch ready for this, but I have no idea how to submit it. There are serious contradictions in this page: https://bugs.ruby-lang.org/projects/ruby/wiki/HowToContribute It says that the changes should be against "the trunk of Ruby", and that "only Ruby 2.4 may accept new features." But the trunk on GitHub is Ruby 2.5. It says that the patch should be a unified diff, but it also says different changes should not be mixed in a single commit. But diff files don't have commits; only pull requests and whole repos do. But it says that you only accept PRs for "tiny fixes", and only if they don't require discussion. ---------------------------------------- Feature #10771: An easy way to get the source location of a constant https://bugs.ruby-lang.org/issues/10771#change-65462 * Author: sawa (Tsuyoshi Sawada) * Status: Open * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * Target version: ---------------------------------------- For constants, it is difficult to get the source location where it was (last) defined. I request either of the following to be implemented: * Tracepoint emits a signal when a constant is defined. * Implement a `Constant` class (similar to `Method` class) and a `constant` method (similar to `method` method) that behave as follows: foo1.rb 1| module Foo 2| Bar = :bar 3| end 4| Foo.constant(:Bar) #=> # 5| Foo.constant(:Bar).source_location #=> ["foo1.rb", 2] * Implement `Module#constant_source_location` foo2.rb 1| module Foo 2| Bar = :bar 3| end 4| Foo.constant_source_location(:Bar) #=> ["foo2.rb", 2] -- https://bugs.ruby-lang.org/ Unsubscribe: