Class: Yuzu::Renderers::CategoryCrumb
- Includes:
- Helpers
- Defined in:
- lib/yuzu/renderers/breadcrumb.rb
Overview
A crumb for blog categories. For multiple categories, this currently adds links for all of them, separated by a slash.
Instance Method Summary collapse
-
#initialize(website_file, level = 0) ⇒ CategoryCrumb
constructor
A new instance of CategoryCrumb.
- #links ⇒ Object
- #separator ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(website_file, level = 0) ⇒ CategoryCrumb
142 143 144 145 146 |
# File 'lib/yuzu/renderers/breadcrumb.rb', line 142 def initialize(website_file, level=0) @website_file = website_file @categories = website_file.categories @level = level end |
Instance Method Details
#links ⇒ Object
152 153 154 |
# File 'lib/yuzu/renderers/breadcrumb.rb', line 152 def links @categories.collect {|cat| cat.link} end |
#separator ⇒ Object
156 157 158 |
# File 'lib/yuzu/renderers/breadcrumb.rb', line 156 def separator " / " end |
#to_s ⇒ Object
148 149 150 |
# File 'lib/yuzu/renderers/breadcrumb.rb', line 148 def to_s Html::Span.new(:class => "breadcrumb_#{@level}") << links.join(separator) end |