Sha256: dcab782dca97eb7fba2caf4ae085a05629a8199147bf3797428f962a72907250

Contents?: true

Size: 611 Bytes

Versions: 2

Compression:

Stored size: 611 Bytes

Contents

# frozen_string_literal: true

module Ariadne
  module Form
    # :nodoc:
    class Caption < BaseComponent
      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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.65 app/components/ariadne/form/caption/component.rb
ariadne_view_components-0.0.64 app/components/ariadne/form/caption/component.rb