Class: RDF::Raptor::FFI::V2::Term
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- RDF::Raptor::FFI::V2::Term
- Includes:
- RDF::Raptor::FFI
- Defined in:
- lib/rdf/raptor/ffi/v2/term.rb
Overview
Defined Under Namespace
Classes: BlankValue, LiteralValue, Value
Constant Summary
Constants included from RDF::Raptor::FFI
Instance Method Summary collapse
-
#initialize(ptr = nil, factory = nil) ⇒ Term
constructor
A new instance of Term.
-
#release(ptr = nil)
Releases
libraptor
memory associated with this structure. - #value ⇒ Object
Methods included from RDF::Raptor::FFI
Constructor Details
#initialize(ptr = nil, factory = nil) ⇒ Term
Returns a new instance of Term.
69 70 71 72 |
# File 'lib/rdf/raptor/ffi/v2/term.rb', line 69 def initialize(ptr = nil, factory = nil) super(ptr) @factory = factory if factory end |
Instance Method Details
#release(ptr = nil)
This method returns an undefined value.
Releases libraptor
memory associated with this structure.
90 91 92 |
# File 'lib/rdf/raptor/ffi/v2/term.rb', line 90 def release(ptr = nil) V2.raptor_free_term(self) unless ptr.null? end |
#value ⇒ Object
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/rdf/raptor/ffi/v2/term.rb', line 74 def value case self[:type] when RAPTOR_TERM_TYPE_BLANK @factory.create_node(self[:value][:blank].to_str) when RAPTOR_TERM_TYPE_URI @factory.create_uri(V2.raptor_uri_as_string(self[:value][:uri])) when RAPTOR_TERM_TYPE_LITERAL self[:value][:literal].to_rdf end end |