mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
While the latter creates an intermediate array of all method names including all ancestors, the former just traverse the inheritance chain and can stop if found once. https://github.com/ruby/prism/commit/6da384dd0e
15 lines
294 B
Ruby
15 lines
294 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "strscan"
|
|
|
|
# Polyfill for StringScanner#scan_byte, which didn't exist until Ruby 3.4.
|
|
if !(StringScanner.method_defined?(:scan_byte))
|
|
StringScanner.include(
|
|
Module.new {
|
|
def scan_byte # :nodoc:
|
|
get_byte&.b&.ord
|
|
end
|
|
}
|
|
)
|
|
end
|