class CodeRay::Scanners::Scanner

def binary_string

will scan next.
To be used with #pos, which is the index of the byte the scanner

The string in binary encoding.
def binary_string
  @binary_string ||=
    if string.respond_to?(:bytesize) && string.bytesize != string.size
      #:nocov:
      string.dup.force_encoding('binary')
      #:nocov:
    else
      string
    end
end