Class: Jekyll::JekyllRdf::Drops::RdfTerm
- Inherits:
-
Liquid::Drop
- Object
- Liquid::Drop
- Jekyll::JekyllRdf::Drops::RdfTerm
- Defined in:
- lib/jekyll/drops/rdf_term.rb
Overview
Represents an RDF term to the Liquid template engine
Direct Known Subclasses
Instance Attribute Summary collapse
-
#term ⇒ Object
readonly
The represented RDF term.
Class Method Summary collapse
-
.build_term_drop(term, site, covered) ⇒ Object
Convert an RDF term into a new Jekyll::Drops::RdfTerm.
Instance Method Summary collapse
- #==(other_obj) ⇒ Object
- #===(other_obj) ⇒ Object
-
#add_necessities(site, page) ⇒ Object
Function stub with no functionality.
- #eql?(other_obj) ⇒ Boolean
-
#initialize(term) ⇒ RdfTerm
constructor
Create a new Jekyll::JekyllRdf::Drops::RdfTerm.
- #inspect ⇒ Object
-
#ready? ⇒ Boolean
Function stub with no functionality.
-
#to_s ⇒ Object
Convert this RdfTerm into a string This should be: - for resources: the IRI - for literals: the literal representation e.g.
Constructor Details
#initialize(term) ⇒ RdfTerm
Create a new Jekyll::JekyllRdf::Drops::RdfTerm
-
term
- The term to be represented
45 46 47 |
# File 'lib/jekyll/drops/rdf_term.rb', line 45 def initialize(term) @term ||= term end |
Instance Attribute Details
#term ⇒ Object (readonly)
The represented RDF term
38 39 40 |
# File 'lib/jekyll/drops/rdf_term.rb', line 38 def term @term end |
Class Method Details
.build_term_drop(term, site, covered) ⇒ Object
Convert an RDF term into a new Jekyll::Drops::RdfTerm
-
term
- The term to be represented -
site
- The Jekyll::Site to be enriched
90 91 92 93 94 95 96 97 98 99 |
# File 'lib/jekyll/drops/rdf_term.rb', line 90 def self.build_term_drop(term, site, covered) case term when RDF::URI, RDF::Node return Jekyll::JekyllRdf::Helper::RdfHelper.resources(term) when RDF::Literal return RdfLiteral.new(term) else return nil end end |
Instance Method Details
#==(other_obj) ⇒ Object
73 74 75 |
# File 'lib/jekyll/drops/rdf_term.rb', line 73 def ==(other_obj) return self.eql? other_obj end |
#===(other_obj) ⇒ Object
81 82 83 |
# File 'lib/jekyll/drops/rdf_term.rb', line 81 def ===(other_obj) return self.to_s.eql? other_obj.to_s end |
#add_necessities(site, page) ⇒ Object
Function stub with no functionality. Its purpose is to keep RdfResource compatible.
52 53 54 |
# File 'lib/jekyll/drops/rdf_term.rb', line 52 def add_necessities(site, page) return self end |
#eql?(other_obj) ⇒ Boolean
77 78 79 |
# File 'lib/jekyll/drops/rdf_term.rb', line 77 def eql? other_obj return (self.to_s.eql? other_obj.to_s)&&((other_obj.class <= self.class)||(self.class <= other_obj.class)||(other_obj.class <= self.term.class)) end |
#inspect ⇒ Object
101 102 103 104 |
# File 'lib/jekyll/drops/rdf_term.rb', line 101 def inspect obj_id = ('%x' % (self.object_id << 1)).to_s return "#<#{self.class.to_s.split("::")[-1]}:0x#{"0"*(14 - obj_id.length)}#{obj_id} @term=#{@term}>" end |
#ready? ⇒ Boolean
Function stub with no functionality. Its purpose is to keep RdfResource compatible.
59 60 61 |
# File 'lib/jekyll/drops/rdf_term.rb', line 59 def ready? return true; end |
#to_s ⇒ Object
Convert this RdfTerm into a string This should be:
-
for resources: the IRI
-
for literals: the literal representation e.g. “Hallo”@de or “123”^^<www.w3.org/2001/XMLSchema#integer>
69 70 71 |
# File 'lib/jekyll/drops/rdf_term.rb', line 69 def to_s term.to_s end |