class RDF::Raptor::FFI::V2::URI
Raptor
has a ‘raptor_uri` class which must be used for manipulating and passing URI
references. The default internal implementation uses `char*` strings for URIs, manipulating them and constructing them.
Public Class Methods
new(ptr_or_name)
click to toggle source
@overload initialize(ptr)
@param [FFI::Pointer] ptr
@overload initialize(name)
@param [RDF::URI, String] name
Calls superclass method
# File lib/rdf/raptor/ffi/v2/uri.rb, line 20 def initialize(ptr_or_name) ptr = case ptr_or_name when FFI::Pointer then ptr_or_name when RDF::URI then V2.raptor_new_uri(V2.world, ptr_or_name.to_s) when String then V2.raptor_new_uri(V2.world, ptr_or_name) else nil end raise ArgumentError, "invalid argument: #{ptr_or_name.inspect}" if ptr.nil? || ptr.null? super(ptr) end
release(ptr)
click to toggle source
Releases ‘libraptor` memory associated with this structure.
@param [FFI::Pointer] ptr @return [void]
# File lib/rdf/raptor/ffi/v2/uri.rb, line 36 def self.release(ptr) V2.raptor_free_uri(ptr) end
Public Instance Methods
==(other)
click to toggle source
@return [Boolean] ‘true` or `false`
# File lib/rdf/raptor/ffi/v2/uri.rb, line 72 def ==(other) return true if self.equal?(other) case other when self.class !(V2.raptor_uri_equals(self, other).zero?) when RDF::URI, String to_str == other.to_str else false end end
Also aliased as: ===
clone()
click to toggle source
@return [URI] a copy of ‘self`
# File lib/rdf/raptor/ffi/v2/uri.rb, line 56 def clone copy = self.class.new(V2.raptor_uri_copy(self)) copy.taint if tainted? copy.freeze if frozen? copy end
dup()
click to toggle source
@return [URI] a copy of ‘self`
# File lib/rdf/raptor/ffi/v2/uri.rb, line 48 def dup copy = self.class.new(V2.raptor_uri_copy(self)) copy.taint if tainted? copy end
eql?(other)
click to toggle source
@return [Boolean] ‘true` or `false`
# File lib/rdf/raptor/ffi/v2/uri.rb, line 86 def eql?(other) return true if self.equal?(other) other.is_a?(self.class) && !(V2.raptor_uri_equals(self, other).zero?) end
hash()
click to toggle source
@return [Fixnum]
# File lib/rdf/raptor/ffi/v2/uri.rb, line 93 def hash to_str.hash end
length()
click to toggle source
@return [Integer]
# File lib/rdf/raptor/ffi/v2/uri.rb, line 65 def length LibC.strlen(self) end
Also aliased as: size
to_rdf()
click to toggle source
@return [RDF::URI]
# File lib/rdf/raptor/ffi/v2/uri.rb, line 106 def to_rdf RDF::URI.intern(to_str) end
Also aliased as: to_uri
to_str()
click to toggle source
@return [String] the URI
string
# File lib/rdf/raptor/ffi/v2/uri.rb, line 99 def to_str V2.raptor_uri_as_string(self) end
Also aliased as: to_s
uri?()
click to toggle source
@return [Boolean] ‘true`
# File lib/rdf/raptor/ffi/v2/uri.rb, line 42 def uri? true end