Class: RoadForest::TypeHandlers::RDFaWriter::SubjectEnvironment
- Inherits:
-
RenderEnvironment
- Object
- RenderEnvironment
- RoadForest::TypeHandlers::RDFaWriter::SubjectEnvironment
- Defined in:
- lib/roadforest/type-handlers/rdfa-writer/subject-environment.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
Returns the value of attribute base.
-
#inlist ⇒ Object
Returns the value of attribute inlist.
-
#predicate_terms ⇒ Object
Returns the value of attribute predicate_terms.
-
#property_objects ⇒ Object
Returns the value of attribute property_objects.
-
#rel ⇒ Object
Returns the value of attribute rel.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#typeof ⇒ Object
Returns the value of attribute typeof.
Attributes inherited from RenderEnvironment
#_engine, #heading_predicates, #lang, #parent
Instance Method Summary collapse
- #about ⇒ Object
- #attrs ⇒ Object
- #each_predicate ⇒ Object
- #is_subject? ⇒ Boolean
- #predicates ⇒ Object
- #render_checked ⇒ Object
- #resource ⇒ Object
- #template_kinds ⇒ Object
Methods inherited from RenderEnvironment
#_base_env_, #add_debug, #escape_entities, #get_content, #get_curie, #get_dt_curie, #get_lang, #get_predicate_name, #get_value, #initialize, #inspect, #like_a?, #list_property_envs, #literal?, #object_env, #simple_property_env, #subject_env, #yielded
Constructor Details
This class inherits a constructor from RoadForest::TypeHandlers::RDFaWriter::RenderEnvironment
Instance Attribute Details
#base ⇒ Object
Returns the value of attribute base.
5 6 7 |
# File 'lib/roadforest/type-handlers/rdfa-writer/subject-environment.rb', line 5 def base @base end |
#inlist ⇒ Object
Returns the value of attribute inlist.
5 6 7 |
# File 'lib/roadforest/type-handlers/rdfa-writer/subject-environment.rb', line 5 def inlist @inlist end |
#predicate_terms ⇒ Object
Returns the value of attribute predicate_terms.
5 6 7 |
# File 'lib/roadforest/type-handlers/rdfa-writer/subject-environment.rb', line 5 def predicate_terms @predicate_terms end |
#property_objects ⇒ Object
Returns the value of attribute property_objects.
5 6 7 |
# File 'lib/roadforest/type-handlers/rdfa-writer/subject-environment.rb', line 5 def property_objects @property_objects end |
#rel ⇒ Object
Returns the value of attribute rel.
5 6 7 |
# File 'lib/roadforest/type-handlers/rdfa-writer/subject-environment.rb', line 5 def rel @rel end |
#subject ⇒ Object
Returns the value of attribute subject.
5 6 7 |
# File 'lib/roadforest/type-handlers/rdfa-writer/subject-environment.rb', line 5 def subject @subject end |
#typeof ⇒ Object
Returns the value of attribute typeof.
5 6 7 |
# File 'lib/roadforest/type-handlers/rdfa-writer/subject-environment.rb', line 5 def typeof @typeof end |
Instance Method Details
#about ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/roadforest/type-handlers/rdfa-writer/subject-environment.rb', line 47 def about if rel.nil? get_curie(subject) else nil end end |
#attrs ⇒ Object
7 8 9 |
# File 'lib/roadforest/type-handlers/rdfa-writer/subject-environment.rb', line 7 def attrs {:rel => rel, :resource => (about || resource), :typeof => typeof, :inlist => inlist} end |
#each_predicate ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/roadforest/type-handlers/rdfa-writer/subject-environment.rb', line 19 def each_predicate predicate_terms.each do |predicate| predicate = RDF::URI(predicate) if predicate.is_a?(String) objects = property_objects[predicate.to_s] next if objects.nil? or objects.empty? nonlists, lists = objects.partition do |object| !_engine.is_list?(object) end add_debug {"properties with lists: #{lists} non-lists: #{nonlists}"} ([simple_property_env(predicate, nonlists)] + list_property_envs(predicate, lists)).compact.each do |env| yield(env) end end end |
#is_subject? ⇒ Boolean
11 12 13 |
# File 'lib/roadforest/type-handlers/rdfa-writer/subject-environment.rb', line 11 def is_subject? true end |
#predicates ⇒ Object
15 16 17 |
# File 'lib/roadforest/type-handlers/rdfa-writer/subject-environment.rb', line 15 def predicates enum_for(:each_predicate) end |
#render_checked ⇒ Object
41 42 43 44 45 |
# File 'lib/roadforest/type-handlers/rdfa-writer/subject-environment.rb', line 41 def render_checked return true if _engine.is_done?(subject) _engine.subject_done(subject) return false end |
#resource ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/roadforest/type-handlers/rdfa-writer/subject-environment.rb', line 55 def resource if rel.nil? nil else get_curie(subject) end end |
#template_kinds ⇒ Object
37 38 39 |
# File 'lib/roadforest/type-handlers/rdfa-writer/subject-environment.rb', line 37 def template_kinds %w{subject} end |