Sha256: fc9f279b3da4e14d6090d6fc9100563060ea4d7140daef79da210ca8903e8601

Contents?: true

Size: 702 Bytes

Versions: 5

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true

module Ariadne
  module Form
    # :nodoc:
    module Caption
      class Component
        Ariadne::Form::BaseInputComponent
        def initialize(input:)
          @input = input
        end

        def caption_template?
          @input.caption_template?
        end

        def render_caption_template
          @input.render_caption_template
        end

        def before_render
          return unless @input.caption? && caption_template?

          raise <<~MESSAGE
            Please provide either a caption: argument or caption template for the
            '#{@input.name}' input; both were found.
          MESSAGE
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.70 app/components/ariadne/form/caption/component.rb
ariadne_view_components-0.0.69 app/components/ariadne/form/caption/component.rb
ariadne_view_components-0.0.68 app/components/ariadne/form/caption/component.rb
ariadne_view_components-0.0.67 app/components/ariadne/form/caption/component.rb
ariadne_view_components-0.0.66 app/components/ariadne/form/caption/component.rb