Module: NitroKit::RadioButtonHelper

Defined in:
app/helpers/nitro_kit/radio_button_helper.rb

Instance Method Summary collapse

Instance Method Details

#nk_radio_button(name, value, *args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/nitro_kit/radio_button_helper.rb', line 3

def nk_radio_button(name, value, *args)
  if args.length >= 3
    raise ArgumentError, "wrong number of arguments (given #{args.length + 2}, expected 2..4)"
  end

  options = args.extract_options!
  checked = args.empty? ? false : args.first

  options[:checked] = "checked" if checked

  render(RadioButton.new(name, value:, name:, value:, **options))
end

#nk_radio_group(name, **options, &block) ⇒ Object



16
17
18
# File 'app/helpers/nitro_kit/radio_button_helper.rb', line 16

def nk_radio_group(name, **options, &block)
  render(RadioGroup.new(name, **options, &block))
end