Sha256: abfc3056c250aef9f362e46696e8ee6314fbe4bb54b6be9bd0273c2a6d606835

Contents?: true

Size: 611 Bytes

Versions: 2

Compression:

Stored size: 611 Bytes

Contents

# frozen_string_literal: true

module Yattho
  module Forms
    # :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
yattho_view_components-0.1.1 lib/yattho/forms/caption.rb
yattho_view_components-0.0.1 lib/yattho/forms/caption.rb