lib/breadcrumbs/render/inline.rb in breadcrumbs-0.1.7 vs lib/breadcrumbs/render/inline.rb in breadcrumbs-0.2.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
class Breadcrumbs
module Render
class Inline < Base # :nodoc: all
def render
options = {
@@ -15,25 +17,24 @@
html << render_item(item, i, size)
end
separator = tag(:span, options[:separator], class: "separator")
- html.join(" #{separator} ")
+ html.join(" #{separator} ").html_safe
end
def render_item(item, i, size)
text, url, options = *item
- options[:class] ||= ""
- css = []
- css << "first" if i == 0
+ css = [options[:class]].compact
+ css << "first" if i.zero?
css << "last" if i == size - 1
css << "item-#{i}"
- options[:class] << " #{css.join(" ")}"
+ options[:class] = css.join(" ")
options[:class].gsub!(/^ *(.*?)$/, '\\1')
- wrap_item(url, CGI.escapeHTML(text), options)
+ wrap_item(url, text, options)
end
end
end
end