Class: Formular::Element::Select

Inherits:
Control
  • Object
show all
Includes:
Modules::Collection
Defined in:
lib/formular/elements.rb

Overview

class Input

Direct Known Subclasses

Bootstrap3::Select, Foundation6::Select

Instance Method Summary collapse

Methods included from Module

included

Instance Method Details

#option_tagsObject

convert the collection array into option tags also supports option groups when the array is nested example 1:

[1,“True”], [0,“False”]

>

<option value=“1”>true</option><option value=“0”>false</option> example 2: [

["Genders", [["m", "Male"], ["f", "Female"]]],
["Booleans", [[1,"true"], [0,"false"]]]

] => <optgroup label=“Genders”>

<option value="m">Male</option>
<option value="f">Female</option>

</optgroup> <optgroup label=“Booleans”>

<option value="1">true</option>
<option value="0">false</option>

</optgroup>



201
202
203
# File 'lib/formular/elements.rb', line 201

def option_tags
  collection_to_options(options[:collection])
end