Class: Arara::Tags::Chipset

Inherits:
ActionView::Helpers::Tags::Base
  • Object
show all
Includes:
ActionView::Helpers::Tags::Placeholderable
Defined in:
app/components/arara/tags/chipset.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object_name, method_name, template_object, options = {}, &block) ⇒ Chipset

Returns a new instance of Chipset.



11
12
13
14
# File 'app/components/arara/tags/chipset.rb', line 11

def initialize(object_name, method_name, template_object, options = {}, &block)
  @block = block
  super
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



8
9
10
# File 'app/components/arara/tags/chipset.rb', line 8

def block
  @block
end

Class Method Details

.field_typeObject



28
29
30
# File 'app/components/arara/tags/chipset.rb', line 28

def field_type
  @field_type ||= name.split("::").last.sub("Field", "").downcase
end

Instance Method Details

#renderObject



16
17
18
19
20
21
22
23
24
25
# File 'app/components/arara/tags/chipset.rb', line 16

def render
  options = @options.stringify_keys
  options["value"] = options.fetch("value") { value_before_type_cast } unless field_type == "file"
  if options["variant"] == :choice
    options["include_choice_hidden_field"] = true
  end
  add_default_name_and_id(options)

  @template_object.template.render(Arara::ChipsetComponent, options.symbolize_keys, &block)
end