Class: Shimmer::Form::RadioField

Inherits:
Field
  • Object
show all
Defined in:
lib/shimmer/form/radio_field.rb

Instance Attribute Summary

Attributes inherited from Field

#builder, #collection, #id_method, #method, #name_method, #options

Instance Method Summary collapse

Methods inherited from Field

can_handle?, #initialize

Constructor Details

This class inherits a constructor from Shimmer::Form::Field

Instance Method Details

#prepareObject



8
9
10
# File 'lib/shimmer/form/radio_field.rb', line 8

def prepare
  @value = options.delete(:value)
end

#renderObject



12
13
14
# File 'lib/shimmer/form/radio_field.rb', line 12

def render
  builder.radio_button method, @value, options
end

#wrapper_optionsObject



16
17
18
# File 'lib/shimmer/form/radio_field.rb', line 16

def wrapper_options
  {label_method: :"#{method}_#{@value.to_s.underscore}"}
end