Class: ElementComponent::Components::NavbarCollapse
- Defined in:
- lib/element_component/components/navbar/collapse.rb
Instance Attribute Summary
Attributes inherited from Element
#attributes, #contents, #element, #html
Instance Method Summary collapse
-
#initialize(id: nil, **attributes, &block) ⇒ NavbarCollapse
constructor
A new instance of NavbarCollapse.
Methods inherited from Element
#add_attribute, #add_attribute!, #add_content, #add_content!, #new_element, #remove_attribute, #remove_attribute_value, #render, #reset_attributes!, #reset_contents!
Constructor Details
#initialize(id: nil, **attributes, &block) ⇒ NavbarCollapse
Returns a new instance of NavbarCollapse.
6 7 8 9 10 11 12 13 |
# File 'lib/element_component/components/navbar/collapse.rb', line 6 def initialize(id: nil, **attributes, &block) super("div", &block) add_attribute(class: "collapse") add_attribute(class: "navbar-collapse") add_attribute(id: id) if id add_attribute(attributes) unless attributes.empty? end |