Class: RdfContext::AbstractSerializer
- Inherits:
-
Object
- Object
- RdfContext::AbstractSerializer
- Defined in:
- lib/rdf_context/serializer/abstract_serializer.rb
Overview
Abstract serializer
Direct Known Subclasses
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(graph) ⇒ AbstractSerializer
constructor
New AbstractSerializer.
-
#relativize(uri) ⇒ String
Create a relative version of the uri parameter if a base URI is defined.
-
#serialize(stream, options = {})
Serialize the graph.
Constructor Details
#initialize(graph) ⇒ AbstractSerializer
New AbstractSerializer
13 14 15 16 |
# File 'lib/rdf_context/serializer/abstract_serializer.rb', line 13 def initialize(graph) @graph = graph @base = nil end |
Instance Attribute Details
#base ⇒ String
8 9 10 |
# File 'lib/rdf_context/serializer/abstract_serializer.rb', line 8 def base @base end |
#graph ⇒ Graph
5 6 7 |
# File 'lib/rdf_context/serializer/abstract_serializer.rb', line 5 def graph @graph end |
Instance Method Details
#relativize(uri) ⇒ String
Create a relative version of the uri parameter if a base URI is defined
29 30 31 32 |
# File 'lib/rdf_context/serializer/abstract_serializer.rb', line 29 def relativize(uri) uri = uri.to_s self.base ? uri.sub(self.base, "") : uri end |
#serialize(stream, options = {})
This method returns an undefined value.
Serialize the graph
23 24 |
# File 'lib/rdf_context/serializer/abstract_serializer.rb', line 23 def serialize(stream, = {}) end |