Class: SemanticBreadcrumbs
- Inherits:
-
Object
- Object
- SemanticBreadcrumbs
- Defined in:
- lib/semantic-breadcrumbs.rb
Instance Method Summary collapse
-
#breadcrumbs(links) ⇒ Object
breadcrumbs takes an array of link hashes and returns HTML markup for breadcrumbs in RDFA format.
-
#initialize(divider: '›') ⇒ SemanticBreadcrumbs
constructor
A new instance of SemanticBreadcrumbs.
Constructor Details
#initialize(divider: '›') ⇒ SemanticBreadcrumbs
Returns a new instance of SemanticBreadcrumbs.
2 3 4 |
# File 'lib/semantic-breadcrumbs.rb', line 2 def initialize(divider: '›') @divider = divider end |
Instance Method Details
#breadcrumbs(links) ⇒ Object
breadcrumbs takes an array of link hashes and returns HTML markup for breadcrumbs in RDFA format
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/semantic-breadcrumbs.rb', line 8 def (links) bcs = [] position = 1 links.each do |link| bcs << single(position: position, **symbolize_keys(link)) position += 1 end return %(<ol class="breadcrumbs" vocab="http://schema.org/" typeof="BreadcrumbList">#{bcs.join(@divider)}</ol>) end |