From 0fcbd072475c96cfca4bc79f0897b39de5cc9e14 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada 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 --- lib/irb/color.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/irb/color.rb b/lib/irb/color.rb index f6b9ed67e1..0f49291d85 100644 --- a/lib/irb/color.rb +++ b/lib/irb/color.rb @@ -146,10 +146,9 @@ module IRB # :nodoc: 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 v1.2.3