Sha256: 7bf1d194d7d1746f787244b74f43b27b99d6991bbdadd9b8fe0c8506cc67f51c

Contents?: true

Size: 805 Bytes

Versions: 2

Compression:

Stored size: 805 Bytes

Contents

require 'rdf'
# override several inspect functions to improve output for what we're doing

class RDF::Literal
  def inspect
    klass = self.class.to_s.match(/([^:]*)$/).to_s
    dt = self.datatype
    "\"#{escape(value)}\"#{('@' + self.language.to_s) if self.language?} R:L:(#{klass == 'Literal' && dt ? dt : klass})"
  end
end

class RDF::URI
  def inspect
    "RDF::URI(#{to_base})"
  end
end

class RDF::Node
  def inspect
    "RDF::Node(#{to_base})"
  end
end

class RDF::Graph
  def inspect
    "RDF::Graph(graph_name: #{self.graph_name || 'nil'})"
  end
end

class RDF::Query
  def inspect
    "RDF::Query(#{graph_name ? graph_name.to_sxp : 'nil'})#{patterns.inspect}"
  end
end

class RDF::Query::Solutions
  def inspect
    string = "vars: #{variable_names.join(",")}\n#{to_a.inspect}"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rdf-spec-3.3.0 lib/rdf/spec/inspects.rb
rdf-spec-3.2.0 lib/rdf/spec/inspects.rb