Module: CurationConcerns::Renderers::ConfiguredMicrodata
- Included in:
- AttributeRenderer
- Defined in:
- app/renderers/curation_concerns/renderers/configured_microdata.rb
Overview
Instance Method Summary collapse
- #microdata?(field) ⇒ Boolean
- #microdata_object?(field) ⇒ Boolean
- #microdata_object_attributes(field) ⇒ Object
- #microdata_property(field) ⇒ Object
- #microdata_type(field) ⇒ Object
- #microdata_value_attributes(field) ⇒ Object
Instance Method Details
#microdata?(field) ⇒ Boolean
4 5 6 7 8 |
# File 'app/renderers/curation_concerns/renderers/configured_microdata.rb', line 4 def microdata?(field) return false unless CurationConcerns.config.display_microdata key = "curation_concerns.schema_org.#{field}.property" t(key, default: false) end |
#microdata_object?(field) ⇒ Boolean
10 11 12 13 14 |
# File 'app/renderers/curation_concerns/renderers/configured_microdata.rb', line 10 def microdata_object?(field) return false unless CurationConcerns.config.display_microdata key = "curation_concerns.schema_org.#{field}.type" t(key, default: false) end |
#microdata_object_attributes(field) ⇒ Object
16 17 18 19 20 21 22 |
# File 'app/renderers/curation_concerns/renderers/configured_microdata.rb', line 16 def microdata_object_attributes(field) if microdata_object?(field) { itemprop: microdata_property(field), itemscope: '', itemtype: microdata_type(field) } else {} end end |
#microdata_property(field) ⇒ Object
24 25 26 |
# File 'app/renderers/curation_concerns/renderers/configured_microdata.rb', line 24 def microdata_property(field) t("curation_concerns.schema_org.#{field}.property") end |
#microdata_type(field) ⇒ Object
28 29 30 |
# File 'app/renderers/curation_concerns/renderers/configured_microdata.rb', line 28 def microdata_type(field) t("curation_concerns.schema_org.#{field}.type") end |
#microdata_value_attributes(field) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'app/renderers/curation_concerns/renderers/configured_microdata.rb', line 32 def microdata_value_attributes(field) if microdata?(field) key = microdata_object?(field) ? :value : :property { itemprop: t("curation_concerns.schema_org.#{field}.#{key}") } else {} end end |