Module: RDF::Spec
- Defined in:
- lib/rdf/spec.rb,
lib/rdf/spec/version.rb,
lib/rdf/spec/matchers.rb
Overview
RDF::Spec
provides RSpec extensions for RDF.rb.
Defined Under Namespace
Constant Summary collapse
- TRIPLES_FILE =
File.("../../../etc/triples.nt", __FILE__)
- QUADS_FILE =
File.("../../../etc/quads.nq", __FILE__)
Class Method Summary collapse
- .logger ⇒ Object
-
.quads ⇒ Array<RDF::Statement>
Return quads for tests.
-
.triples ⇒ Array<RDF::Statement>
Return triples for tests.
Class Method Details
.logger ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/rdf/spec.rb', line 77 def self.logger logger = Logger.new(StringIO.new) logger.instance_eval do def clear @logdev.instance_variable_set(:@dev, StringIO.new) end def to_s dev = @logdev.instance_variable_get(:@dev) dev.rewind dev.read end end logger.level = Logger::DEBUG logger.formatter = lambda {|severity, datetime, progname, msg| "%5s %s\n" % [severity, msg]} logger end |
.quads ⇒ Array<RDF::Statement>
Return quads for tests
61 62 63 64 |
# File 'lib/rdf/spec.rb', line 61 def self.quads require 'rdf/nquads' (@quads ||= RDF::NQuads::Reader.new(File.open(QUADS_FILE)).to_a).dup end |
.triples ⇒ Array<RDF::Statement>
Return triples for tests
70 71 72 73 |
# File 'lib/rdf/spec.rb', line 70 def self.triples require 'rdf/ntriples' (@triples ||= RDF::NTriples::Reader.new(File.open(TRIPLES_FILE)).to_a).dup end |