Class: Shoehorn::Components::Dropdown
- Defined in:
- lib/shoehorn/components/dropdown.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(elements, options = {}) ⇒ Dropdown
constructor
A new instance of Dropdown.
- #to_s ⇒ Object
Constructor Details
#initialize(elements, options = {}) ⇒ Dropdown
Returns a new instance of Dropdown.
5 6 7 8 |
# File 'lib/shoehorn/components/dropdown.rb', line 5 def initialize(elements, = {}) super @elements = elements end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
3 4 5 |
# File 'lib/shoehorn/components/dropdown.rb', line 3 def collection @collection end |
Instance Method Details
#to_s ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/shoehorn/components/dropdown.rb', line 10 def to_s = {:class => build_class} output_buffer << content_tag(:div, .reverse_merge([:html_options])) do html='' html << build_dropdown html << content_tag(:ul, :class => 'dropdown-menu') do = '' @elements.each do |e| << content_tag(:li, e.to_s) end .html_safe end html.html_safe end super end |