Method: HTML5::EncodingBytes#match_bytes

Defined in:
lib/html5/inputstream.rb

#match_bytes(bytes, lower = false) ⇒ Object

Look for a sequence of bytes at the start of a string. If the bytes are found return true and advance the position to the byte after the match. Otherwise return false and leave the position alone



449
450
451
452
453
454
455
# File 'lib/html5/inputstream.rb', line 449

def match_bytes(bytes, lower=false)
  data = self[position ... position+bytes.length]
  data.downcase! if lower
  rv = (data == bytes)
  @position += bytes.length if rv == true
  return rv
end