Sha256: 5a90958b35592116ba5441546d452ef76f0a9f3aeacbd4bb1acd9fcac2ca8eae

Contents?: true

Size: 670 Bytes

Versions: 50

Compression:

Stored size: 670 Bytes

Contents

module GOVUKDesignSystemFormBuilder
  module Traits
    module Hint
      def hint_id
        return unless hint_element.active?

        build_id('hint')
      end

    private

      def hint_element
        @hint_element ||= if @hint.nil?
                            Elements::Null.new
                          else
                            Elements::Hint.new(*bound, **hint_content)
                          end
      end

      def hint_content
        case @hint
        when Hash
          @hint
        when Proc
          { content: @hint }
        else
          fail(ArgumentError, %(hint must be a Proc or Hash))
        end
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 2 rubygems

Version Path
govuk_design_system_formbuilder-5.8.0 lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-5.7.1 lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-5.7.0 lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-5.6.0 lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-5.5.0 lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-5.4.1 lib/govuk_design_system_formbuilder/traits/hint.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/govuk_design_system_formbuilder-5.4.0/lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-5.3.3 lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-5.3.2 lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-5.3.1 lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-5.3.0 lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-5.2.0 lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-5.1.0 lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-5.1.0b1 lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-5.0.0 lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-5.0.0b1 lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-4.1.1 lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-4.1.0 lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-4.0.0 lib/govuk_design_system_formbuilder/traits/hint.rb
govuk_design_system_formbuilder-4.0.0rc1 lib/govuk_design_system_formbuilder/traits/hint.rb