[前][次][番号順一覧][スレッド一覧]

ruby-changes:67659

From: aycabta <ko1@a...>
Date: Wed, 8 Sep 2021 05:23:59 +0900 (JST)
Subject: [ruby-changes:67659] c5e8088c7e (master): [ruby/irb] Define absolute_path? by myself for backward compatibility

https://git.ruby-lang.org/ruby.git/commit/?id=c5e8088c7e

From c5e8088c7e1c67566f0c2fed0c377c4c8b1990c2 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Wed, 8 Sep 2021 04:51:09 +0900
Subject: [ruby/irb] Define absolute_path? by myself for backward compatibility

https://github.com/ruby/irb/commit/d9c0dc043e
---
 lib/irb/completion.rb | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
index 9a5d858..597dcda 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -38,10 +38,22 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/completion.rb#L38
 
     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)
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]