module RDF::Util::File

Wrapper for Kernel.open. Allows implementations to override to get more suffisticated behavior for HTTP resources (e.g., Accept header).

Also supports the file: scheme for access to local files.

Classes include this module when they represent some form of a file as a base resource, for instance an HTTP resource representing the serialization of a Graph.

This module may be monkey-patched to allow for more options and interfaces.

@since 0.2.4

Public Class Methods

open_gzipfile(filename_or_url, options = {}, &block) click to toggle source

Open the file, returning or yielding an IO stream and mime_type.

@param [String] filename_or_url to open @param [Hash{Symbol => Object}] options any options to pass through to the underlying UUID library @return [IO] File stream @yield [IO] File stream

# File lib/rdf/util/file.rb, line 25
def self.open_gzipfile(filename_or_url, options = {}, &block)
  filename_or_url = $1 if filename_or_url.to_s.match(/^file:(.*)$/)
  f = Zlib::GzipReader.open(filename_or_url.to_s, &block)
end