Class: Marsdawn::Site::Breadcrumb
- Inherits:
-
Hash
- Object
- Hash
- Marsdawn::Site::Breadcrumb
- Defined in:
- lib/marsdawn/site/breadcrumb.rb
Instance Method Summary collapse
-
#initialize(site, crumb) ⇒ Breadcrumb
constructor
A new instance of Breadcrumb.
- #to_html ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(site, crumb) ⇒ Breadcrumb
Returns a new instance of Breadcrumb.
6 7 8 9 10 11 |
# File 'lib/marsdawn/site/breadcrumb.rb', line 6 def initialize site, crumb @site = site crumb.each do |path| self[path] = Marsdawn::Site::Link.new(@site, path) end end |
Instance Method Details
#to_html ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/marsdawn/site/breadcrumb.rb', line 17 def to_html words = [] if self.size > 0 words << '<ul>' self.each do |uri, link| words << "<li>#{link.to_html}</li>" end words << '</ul>' end words.join('') end |
#to_s ⇒ Object
13 14 15 |
# File 'lib/marsdawn/site/breadcrumb.rb', line 13 def to_s to_html end |