1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/irb] Define absolute_path? by myself for backward compatibility

https://github.com/ruby/irb/commit/d9c0dc043e
This commit is contained in:
aycabta 2021-09-08 04:51:09 +09:00 committed by git
parent 04984415a5
commit c5e8088c7e

View file

@ -38,10 +38,22 @@ module IRB
BASIC_WORD_BREAK_CHARACTERS = " \t\n`><=;|&{(" 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 def self.retrieve_gem_and_system_load_path
gem_paths = Gem::Specification.latest_specs(true).map { |s| gem_paths = Gem::Specification.latest_specs(true).map { |s|
s.require_paths.map { |p| s.require_paths.map { |p|
if File.absolute_path?(p) if absolute_path?(p)
p p
else else
File.join(s.full_gem_path, p) File.join(s.full_gem_path, p)