Module: RDF::Util::File
- Defined in:
- lib/rdf/util/file.rb
Overview
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.
Instance Attribute Summary collapse
-
#content_type ⇒ String
Content.
Class Method Summary collapse
-
.open_file(filename_or_url, options = {}) {|IO| ... } ⇒ IO
Open the file, returning or yielding an IO stream and mime_type.
Instance Attribute Details
#content_type ⇒ String
Content
19 20 21 |
# File 'lib/rdf/util/file.rb', line 19 def content_type @content_type end |
Class Method Details
.open_file(filename_or_url, options = {}) {|IO| ... } ⇒ IO
Open the file, returning or yielding an IO stream and mime_type.
33 34 35 36 |
# File 'lib/rdf/util/file.rb', line 33 def self.open_file(filename_or_url, = {}, &block) filename_or_url = $1 if filename_or_url.to_s.match(/^file:(.*)$/) Kernel.open(filename_or_url.to_s, &block) end |