Class: Yuzu::Renderers::CategoryCrumb

Inherits:
Crumb show all
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

Constructor Details

#initialize(website_file, level = 0) ⇒ CategoryCrumb

Returns a new instance of 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



152
153
154
# File 'lib/yuzu/renderers/breadcrumb.rb', line 152

def links
  @categories.collect {|cat| cat.link}
end

#separatorObject



156
157
158
# File 'lib/yuzu/renderers/breadcrumb.rb', line 156

def separator
  " / "
end

#to_sObject



148
149
150
# File 'lib/yuzu/renderers/breadcrumb.rb', line 148

def to_s
  Html::Span.new(:class => "breadcrumb_#{@level}") << links.join(separator)
end