Class: GovukPublishingComponents::Presenters::ArticleSchema
- Inherits:
-
Object
- Object
- GovukPublishingComponents::Presenters::ArticleSchema
- Defined in:
- lib/govuk_publishing_components/presenters/machine_readable/article_schema.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
Instance Method Summary collapse
-
#initialize(page) ⇒ ArticleSchema
constructor
A new instance of ArticleSchema.
- #structured_data ⇒ Object
Constructor Details
#initialize(page) ⇒ ArticleSchema
Returns a new instance of ArticleSchema.
6 7 8 |
# File 'lib/govuk_publishing_components/presenters/machine_readable/article_schema.rb', line 6 def initialize(page) @page = page end |
Instance Attribute Details
#page ⇒ Object (readonly)
Returns the value of attribute page.
4 5 6 |
# File 'lib/govuk_publishing_components/presenters/machine_readable/article_schema.rb', line 4 def page @page end |
Instance Method Details
#structured_data ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/govuk_publishing_components/presenters/machine_readable/article_schema.rb', line 10 def structured_data # http://schema.org/Article data = CreativeWorkSchema.new(@page).structured_data .merge(head_line) .merge(body) .merge(search_action) data["@type"] = "Article" data end |