DFE-Digital/govuk-formbuilder

View on GitHub
lib/govuk_design_system_formbuilder/traits/error.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
module GOVUKDesignSystemFormBuilder
  module Traits
    module Error
      def error_id
        return unless has_errors?

        build_id('error')
      end

    private

      def error_element
        @error_element ||= Elements::ErrorMessage.new(*bound)
      end

      def set_message_safety(message)
        config.trust_error_messages ? message.html_safe : message
      end
    end
  end
end