Class: Fidelity::Widget::Breadcrumb
- Inherits:
-
Object
- Object
- Fidelity::Widget::Breadcrumb
- Defined in:
- app/fidelity/widgets/breadcrumb/breadcrumb.rb
Defined Under Namespace
Classes: Item
Instance Attribute Summary collapse
-
#items ⇒ Object
Returns the value of attribute items.
-
#template ⇒ Object
Returns the value of attribute template.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(template, options = {}) ⇒ Breadcrumb
constructor
A new instance of Breadcrumb.
- #item(label = 'Item', options = {}, &block) ⇒ Object
Constructor Details
#initialize(template, options = {}) ⇒ Breadcrumb
Returns a new instance of Breadcrumb.
6 7 8 9 |
# File 'app/fidelity/widgets/breadcrumb/breadcrumb.rb', line 6 def initialize template, ={} @template = template @items = [] end |
Instance Attribute Details
#items ⇒ Object
Returns the value of attribute items.
5 6 7 |
# File 'app/fidelity/widgets/breadcrumb/breadcrumb.rb', line 5 def items @items end |
#template ⇒ Object
Returns the value of attribute template.
5 6 7 |
# File 'app/fidelity/widgets/breadcrumb/breadcrumb.rb', line 5 def template @template end |
Instance Method Details
#each ⇒ Object
17 18 19 20 21 |
# File 'app/fidelity/widgets/breadcrumb/breadcrumb.rb', line 17 def each @items.each do |item| yield item end end |
#item(label = 'Item', options = {}, &block) ⇒ Object
11 12 13 14 15 |
# File 'app/fidelity/widgets/breadcrumb/breadcrumb.rb', line 11 def item label='Item', ={}, &block content = template.capture(&block) if block_given? state = [:state] || :default @items << Item.new(label, content, state, [:path]) end |