module CodeRay::FileType

def fetch filename, default = nil, read_shebang = false

is returned.
If the filetype cannot be found, the +default+ value

This works like Hash#fetch.
def fetch filename, default = nil, read_shebang = false
  if default && block_given?
    warn 'Block supersedes default value argument; use either.'
  end
  
  if type = self[filename, read_shebang]
    type
  else
    return yield if block_given?
    return default if default
    raise UnknownFileType, 'Could not determine type of %p.' % filename
  end
end