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

ruby-changes:62617

From: Nobuyoshi <ko1@a...>
Date: Tue, 18 Aug 2020 18:57:11 +0900 (JST)
Subject: [ruby-changes:62617] 0fcbd07247 (master): [ruby/irb] Directly check if the method is available instead of version

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

From 0fcbd072475c96cfca4bc79f0897b39de5cc9e14 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 12 Aug 2020 11:14:12 +0900
Subject: [ruby/irb] Directly check if the method is available instead of
 version

https://github.com/ruby/irb/commit/3ea9fd9ed0

diff --git a/lib/irb/color.rb b/lib/irb/color.rb
index f6b9ed6..0f49291 100644
--- a/lib/irb/color.rb
+++ b/lib/irb/color.rb
@@ -146,10 +146,9 @@ module IRB # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/irb/color.rb#L146
         seen.delete(obj)
       end
 
-      # Ripper::Lexer::Elem#state is supported on Ruby 2.5+
       def supported?
         return @supported if defined?(@supported)
-        @supported = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.5.0')
+        @supported = Ripper::Lexer::Elem.method_defined?(:state)
       end
 
       def scan(code, allow_last_error:)
-- 
cgit v0.10.2


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

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