Class: GovukPublishingComponents::Presenters::HasPartSchema

Inherits:
Object
  • Object
show all
Defined in:
lib/govuk_publishing_components/presenters/machine_readable/has_part_schema.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(has_part_url) ⇒ HasPartSchema

Returns a new instance of HasPartSchema.



6
7
8
# File 'lib/govuk_publishing_components/presenters/machine_readable/has_part_schema.rb', line 6

def initialize(has_part_url)
  @has_part_url = has_part_url
end

Instance Attribute Details

#has_part_urlObject (readonly)

Returns the value of attribute has_part_url.



4
5
6
# File 'lib/govuk_publishing_components/presenters/machine_readable/has_part_schema.rb', line 4

def has_part_url
  @has_part_url
end

Instance Method Details

#structured_dataObject



10
11
12
13
14
15
16
17
# File 'lib/govuk_publishing_components/presenters/machine_readable/has_part_schema.rb', line 10

def structured_data
  # http://schema.org/hasPart - minimal
  {
    "@context" => "http://schema.org",
    "@type" => "CreativeWork",
    "sameAs" => has_part_url,
  }
end