Skip to content

Commit d9c0dc0

Browse files
committed
Define absolute_path? by myself for backward compatibility
1 parent c870b23 commit d9c0dc0

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/irb/completion.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,22 @@ def defined? do
3838

3939
BASIC_WORD_BREAK_CHARACTERS = " \t\n`><=;|&{("
4040

41+
def self.absolute_path?(p) # TODO Remove this method after 2.6 EOL.
42+
if File.respond_to?(:absolute_path?)
43+
File.absolute_path?(p)
44+
else
45+
if File.absolute_path(p) == p
46+
true
47+
else
48+
false
49+
end
50+
end
51+
end
52+
4153
def self.retrieve_gem_and_system_load_path
4254
gem_paths = Gem::Specification.latest_specs(true).map { |s|
4355
s.require_paths.map { |p|
44-
if File.absolute_path?(p)
56+
if absolute_path?(p)
4557
p
4658
else
4759
File.join(s.full_gem_path, p)

0 commit comments

Comments
 (0)