Class: IqRdf::Literal::URI

Inherits:
IqRdf::Literal show all
Defined in:
lib/iq_rdf/literal/uri.rb

Instance Method Summary collapse

Methods inherited from IqRdf::Literal

build

Constructor Details

#initialize(uri) ⇒ URI

Returns a new instance of URI.



5
6
7
8
# File 'lib/iq_rdf/literal/uri.rb', line 5

def initialize(uri)
  raise "#{uri.inspect} is not an URI" unless uri.is_a?(::URI)
  super(uri)
end

Instance Method Details

#build_xml(xml, &block) ⇒ Object



18
19
20
# File 'lib/iq_rdf/literal/uri.rb', line 18

def build_xml(xml, &block)
  block.call("rdf:resource" => @obj.to_s)
end

#to_ntriples(parent_lang = nil) ⇒ Object



14
15
16
# File 'lib/iq_rdf/literal/uri.rb', line 14

def to_ntriples(parent_lang = nil)
  "<#{@obj.to_s}>"
end

#to_s(options = {}) ⇒ Object



10
11
12
# File 'lib/iq_rdf/literal/uri.rb', line 10

def to_s(options = {})
  "<#{@obj.to_s}>"
end