Sha256: 4b7287ca10c90a590df93e3aeb309408156cdc2a8a3e60535b800e2fe0b7a684
Contents?: true
Size: 906 Bytes
Versions: 1
Compression:
Stored size: 906 Bytes
Contents
class Breadcrumbs module Render class Inline < Base # :nodoc: all def render options = { class: "breadcrumbs", separator: "»" }.merge(default_options) html = [] items = breadcrumbs.items size = items.size items.each_with_index do |item, i| html << render_item(item, i, size) end separator = tag(:span, options[:separator], class: "separator") html.join(" #{separator} ") end def render_item(item, i, size) text, url, options = *item options[:class] ||= "" css = [] css << "first" if i == 0 css << "last" if i == size - 1 css << "item-#{i}" options[:class] << " #{css.join(" ")}" options[:class].gsub!(/^ *(.*?)$/, '\\1') wrap_item(url, CGI.escapeHTML(text), options) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
breadcrumbs-0.1.7 | lib/breadcrumbs/render/inline.rb |