diff options
author | Stan Lo <stan001212@gmail.com> | 2023-01-04 09:35:52 +0000 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-01-04 09:35:57 +0000 |
commit | 3d6500ee6e3676979d5199dc7b5feab0d15235de (patch) | |
tree | 8791a38600916620c1751b65ec248ed830cae69f /lib/irb | |
parent | e25c173c97e1e0e538aeb85734cabcbb59cd11ab (diff) |
[ruby/irb] workspace.rb cleanup
(https://github.com/ruby/irb/pull/489)
* Remove unnecessary Binding#source_location check
`Binding#source_location` was added in 2.6, which is the minimum supported
version now. So this check is no longer necessary.
* Remove unused IRB.delete_caller
This method was added in the earliest version of IRB:
https://github.com/ruby/irb/commit/f47808999d24865fba1929dea1a7011ff5a517d6
But it's not currently referenced by anything. We can verify this with a
org-wide search result:
https://github.com/search?q=org%3Aruby+delete_caller&type=code
Diffstat (limited to 'lib/irb')
-rw-r--r-- | lib/irb/workspace.rb | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/lib/irb/workspace.rb b/lib/irb/workspace.rb index e5ef52528a..a3d8891b86 100644 --- a/lib/irb/workspace.rb +++ b/lib/irb/workspace.rb @@ -142,11 +142,7 @@ EOF end def code_around_binding - if @binding.respond_to?(:source_location) - file, pos = @binding.source_location - else - file, pos = @binding.eval('[__FILE__, __LINE__]') - end + file, pos = @binding.source_location if defined?(::SCRIPT_LINES__[file]) && lines = ::SCRIPT_LINES__[file] code = ::SCRIPT_LINES__[file].join('') @@ -173,8 +169,5 @@ EOF "\nFrom: #{file} @ line #{pos + 1} :\n\n#{body}#{Color.clear}\n" end - - def IRB.delete_caller - end end end |