summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-08-12 11:14:12 +0900
committeraycabta <aycabta@gmail.com>2020-08-18 14:38:01 +0900
commit0fcbd072475c96cfca4bc79f0897b39de5cc9e14 (patch)
tree5ef9c363c31313accdaf421a11296bf8d3420fdb /lib
parent6aa786b8a3a2bd817839edde8ace54efc0681d42 (diff)
[ruby/irb] Directly check if the method is available instead of version
https://github.com/ruby/irb/commit/3ea9fd9ed0
Diffstat (limited to 'lib')
-rw-r--r--lib/irb/color.rb3
1 files changed, 1 insertions, 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:)