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

[ruby/irb] Directly check if the method is available instead of version

https://github.com/ruby/irb/commit/3ea9fd9ed0
This commit is contained in:
Nobuyoshi Nakada 2020-08-12 11:14:12 +09:00 committed by aycabta
parent 6aa786b8a3
commit 0fcbd07247

View file

@ -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:)