lib/magic_bytes.rb
def read_and_detect(io)
    first_n_bytes = io.read(HEADER_SIZE)
    raise ReadError unless first_n_bytes
    detect(first_n_bytes)
  end
# Performs detection from a given IO or File.
#
# @param io[#read] a readable object
# @return [Hash, nil] the hash of ext: and mime: or nil if the type could not be deduced
Performs detection from a given IO or File.
Performs detection from a given IO or File .
def read_and_detect(io)
    first_n_bytes = io.read(HEADER_SIZE)
    raise ReadError unless first_n_bytes
    detect(first_n_bytes)
  end
def read_and_detect ( io ) first_n_bytes = io . read ( HEADER_SIZE ) raise ReadError unless first_n_bytes detect ( first_n_bytes ) end
Performs detection from a given IO or File.
Performs detection from a given IO or File .
the hash of ext: and mime: or nil if the type could not be deduced
the hash of ext : and mime : or nil if the type could not be deduced
Hash, nil
io
a readable object
a readable object