Sha256: 7ea988c1d9d7484ee3714b32eee978e33d9cacfdc76cc989fef122ad1cbbe281

Contents?: true

Size: 791 Bytes

Versions: 2

Compression:

Stored size: 791 Bytes

Contents

# frozen_string_literal: true

module Yattho
  module Forms
    module Dsl
      # :nodoc:
      class RadioButtonInput < Input
        attr_reader :name, :value, :label, :nested_form_block, :nested_form_arguments

        def initialize(name:, value:, label:, **system_arguments)
          @name = name
          @value = value
          @label = label

          super(**system_arguments)

          yield(self) if block_given?
        end

        def to_component
          RadioButton.new(input: self)
        end

        def nested_form(**system_arguments, &block)
          @nested_form_arguments = system_arguments
          @nested_form_block = block
        end

        # :nocov:
        def type
          :radio_button
        end
        # :nocov:
      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/dsl/radio_button_input.rb
yattho_view_components-0.0.1 lib/yattho/forms/dsl/radio_button_input.rb