Sha256: 18b5b171fc1a72e46cc10ad8eee6fd7b64e06a331bbac1f86026d16f41e75caa

Contents?: true

Size: 705 Bytes

Versions: 4

Compression:

Stored size: 705 Bytes

Contents

module GovukPublishingComponents
  module Presenters
    class DevolvedNationsHelper
      attr_reader :national_applicability

      def initialize(local_assigns)
        @national_applicability = local_assigns[:national_applicability]
      end

      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

      def nations_with_urls
        @national_applicability
          .select do |_, v|
            v[:alternative_url]
            .present?
          end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
govuk_publishing_components-27.3.0 lib/govuk_publishing_components/presenters/devolved_nations_helper.rb
govuk_publishing_components-27.2.0 lib/govuk_publishing_components/presenters/devolved_nations_helper.rb
govuk_publishing_components-27.1.0 lib/govuk_publishing_components/presenters/devolved_nations_helper.rb
govuk_publishing_components-27.0.0 lib/govuk_publishing_components/presenters/devolved_nations_helper.rb