Sha256: 2a1ccb2792563449da5e11d148c3d4c2a243f8bcb88a435cd7dc28c6c6e3c6bd

Contents?: true

Size: 925 Bytes

Versions: 3

Compression:

Stored size: 925 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', 'uriref')

module RdfContext
  # Abstract serializer
  class AbstractSerializer
    # @return [Graph]
    attr_accessor :graph
    
    # @return [String]
    attr_accessor :base
    
    # New AbstractSerializer
    # @param [Graph] graph
    # @return [AbstractSerializer]
    def initialize(graph)
      @graph = graph
      @base = nil
    end
    
    # Serialize the graph
    #
    # @param [IO, StreamIO] stream Stream in which to place serialized graph
    # @option options [URIRef, String] :base (nil) Base URI of graph, used to shorting URI references
    # @return [void]
    def serialize(stream, options = {})
    end
    
    # Create a relative version of the _uri_ parameter if a _base_ URI is defined
    # @param [#to_s] uri
    # @return [String]
    def relativize(uri)
      uri = uri.to_s
      self.base ? uri.sub(self.base, "") : uri
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rdf_context-0.5.9.1 lib/rdf_context/serializer/abstract_serializer.rb
rdf_context-0.5.9 lib/rdf_context/serializer/abstract_serializer.rb
rdf_context-0.5.8.2 lib/rdf_context/serializer/abstract_serializer.rb