Class: Trestle::Breadcrumb::Trail
- Inherits:
-
Object
- Object
- Trestle::Breadcrumb::Trail
- Includes:
- Enumerable
- Defined in:
- lib/trestle/breadcrumb.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
- #append(label, path = nil) ⇒ Object
- #dup ⇒ Object
-
#initialize(breadcrumbs = []) ⇒ Trail
constructor
A new instance of Trail.
- #prepend(label, path = nil) ⇒ Object
Constructor Details
#initialize(breadcrumbs = []) ⇒ Trail
Returns a new instance of Trail.
31 32 33 |
# File 'lib/trestle/breadcrumb.rb', line 31 def initialize(=[]) @breadcrumbs = Array().compact end |
Instance Method Details
#==(other) ⇒ Object
35 36 37 |
# File 'lib/trestle/breadcrumb.rb', line 35 def ==(other) to_a == other.to_a end |
#append(label, path = nil) ⇒ Object
43 44 45 |
# File 'lib/trestle/breadcrumb.rb', line 43 def append(label, path=nil) @breadcrumbs << Breadcrumb.new(label, path) end |
#dup ⇒ Object
39 40 41 |
# File 'lib/trestle/breadcrumb.rb', line 39 def dup self.class.new(@breadcrumbs.dup) end |
#prepend(label, path = nil) ⇒ Object
47 48 49 |
# File 'lib/trestle/breadcrumb.rb', line 47 def prepend(label, path=nil) @breadcrumbs.unshift(Breadcrumb.new(label, path)) end |