Class: Udongo::Breadcrumb

Inherits:
Object
  • Object
show all
Defined in:
lib/udongo/breadcrumb.rb

Instance Method Summary collapse

Constructor Details

#initializeBreadcrumb

Returns a new instance of Breadcrumb.



3
4
5
# File 'lib/udongo/breadcrumb.rb', line 3

def initialize
  @items = []
end

Instance Method Details

#add(name, link = nil) ⇒ Object



11
12
13
# File 'lib/udongo/breadcrumb.rb', line 11

def add(name, link = nil)
  @items << { name: name, link: link }
end

#allObject



7
8
9
# File 'lib/udongo/breadcrumb.rb', line 7

def all
  @items
end

#any?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/udongo/breadcrumb.rb', line 15

def any?
  @items.any?
end

#eachObject



19
20
21
22
23
24
25
# File 'lib/udongo/breadcrumb.rb', line 19

def each
  raise 'Block expected' unless block_given?

  if block_given?
    @items.each { |i| yield(i) }
  end
end