class GovukPublishingComponents::Presenters::DevolvedNationsHelper

Attributes

national_applicability[R]

Public Class Methods

new(local_assigns) click to toggle source
# File lib/govuk_publishing_components/presenters/devolved_nations_helper.rb, line 6
def initialize(local_assigns)
  @national_applicability = local_assigns[:national_applicability]
end

Public Instance Methods

applicable_nations_title_text() click to toggle source
# File lib/govuk_publishing_components/presenters/devolved_nations_helper.rb, line 10
def applicable_nations_title_text
  @national_applicability
    .select { |_, v| v[:applicable] == true }
    .map { |k, _| I18n.t("components.devolved_nations.#{k}") }
    .sort
    .to_sentence(last_word_connector: " and ")
end
nations_with_urls() click to toggle source
# File lib/govuk_publishing_components/presenters/devolved_nations_helper.rb, line 18
def nations_with_urls
  @national_applicability
    .select do |_, v|
      v[:alternative_url]
      .present?
    end
end