Class: ElementComponent::Components::BreadcrumbItem
- Defined in:
- lib/element_component/components/breadcrumb/item.rb
Instance Attribute Summary
Attributes inherited from Element
#attributes, #contents, #element, #html
Instance Method Summary collapse
-
#initialize(href: nil, active: false, **attributes, &block) ⇒ BreadcrumbItem
constructor
A new instance of BreadcrumbItem.
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(href: nil, active: false, **attributes, &block) ⇒ BreadcrumbItem
Returns a new instance of BreadcrumbItem.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/element_component/components/breadcrumb/item.rb', line 6 def initialize(href: nil, active: false, **attributes, &block) super("li", &block) add_attribute(class: "breadcrumb-item") add_attribute(class: "active") if active add_attribute("aria-current": "page") if active add_attribute(attributes) unless attributes.empty? @href = href end |