summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2021-09-08 04:51:09 +0900
committergit <svn-admin@ruby-lang.org>2021-09-08 05:23:50 +0900
commitc5e8088c7e1c67566f0c2fed0c377c4c8b1990c2 (patch)
tree2e1c2fbb57d5b9185c3bcadf3786513609644800
parent04984415a5fc59ff316830f0ddadf7ed61b765ba (diff)
[ruby/irb] Define absolute_path? by myself for backward compatibility
https://github.com/ruby/irb/commit/d9c0dc043e
-rw-r--r--lib/irb/completion.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
index 9a5d8580ac..597dcdaa81 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -38,10 +38,22 @@ module IRB
BASIC_WORD_BREAK_CHARACTERS = " \t\n`><=;|&{("
+ def self.absolute_path?(p) # TODO Remove this method after 2.6 EOL.
+ if File.respond_to?(:absolute_path?)
+ File.absolute_path?(p)
+ else
+ if File.absolute_path(p) == p
+ true
+ else
+ false
+ end
+ end
+ end
+
def self.retrieve_gem_and_system_load_path
gem_paths = Gem::Specification.latest_specs(true).map { |s|
s.require_paths.map { |p|
- if File.absolute_path?(p)
+ if absolute_path?(p)
p
else
File.join(s.full_gem_path, p)