Class: GovukPublishingComponents::AppHelpers::TaxonBreadcrumbs::ContentItem
- Inherits:
-
Object
- Object
- GovukPublishingComponents::AppHelpers::TaxonBreadcrumbs::ContentItem
- Defined in:
- lib/govuk_publishing_components/app_helpers/taxon_breadcrumbs.rb
Instance Attribute Summary collapse
-
#content_item ⇒ Object
readonly
Returns the value of attribute content_item.
Instance Method Summary collapse
- #base_path ⇒ Object
-
#initialize(content_item) ⇒ ContentItem
constructor
A new instance of ContentItem.
- #parent_taxon ⇒ Object
- #phase_is_live?(taxon) ⇒ Boolean
- #title ⇒ Object
Constructor Details
#initialize(content_item) ⇒ ContentItem
Returns a new instance of ContentItem.
50 51 52 |
# File 'lib/govuk_publishing_components/app_helpers/taxon_breadcrumbs.rb', line 50 def initialize(content_item) @content_item = content_item end |
Instance Attribute Details
#content_item ⇒ Object (readonly)
Returns the value of attribute content_item.
48 49 50 |
# File 'lib/govuk_publishing_components/app_helpers/taxon_breadcrumbs.rb', line 48 def content_item @content_item end |
Instance Method Details
#base_path ⇒ Object
70 71 72 |
# File 'lib/govuk_publishing_components/app_helpers/taxon_breadcrumbs.rb', line 70 def base_path content_item.fetch("base_path") end |
#parent_taxon ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/govuk_publishing_components/app_helpers/taxon_breadcrumbs.rb', line 54 def parent_taxon @parent_taxon ||= begin parent_content_item = content_item.dig("links", "parent_taxons", 0) ContentItem.new(parent_content_item) unless parent_content_item.nil? end end |
#phase_is_live?(taxon) ⇒ Boolean
62 63 64 |
# File 'lib/govuk_publishing_components/app_helpers/taxon_breadcrumbs.rb', line 62 def phase_is_live?(taxon) taxon["phase"] == "live" end |
#title ⇒ Object
66 67 68 |
# File 'lib/govuk_publishing_components/app_helpers/taxon_breadcrumbs.rb', line 66 def title content_item.fetch("title") end |