Class: Formular::Element::Select

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

Overview

class Input

Direct Known Subclasses

Bootstrap3::Select, Foundation6::Select

Constant Summary

Constants included from HtmlEscape

HtmlEscape::HTML_ESCAPE, HtmlEscape::HTML_ESCAPE_ONCE_REGEXP, HtmlEscape::HTML_ESCAPE_REGEXP

Instance Method Summary collapse

Methods included from HtmlEscape

#html_escape, #html_escape_once

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>



219
220
221
# File 'lib/formular/elements.rb', line 219

def option_tags
  collection_to_options(options[:collection])
end