class Avo::Concerns::Breadcrumbs::Builder
def breadcrumbs
def breadcrumbs context.avo_breadcrumbs end
def compute_name(element)
def compute_name(element) case name = element.name when Symbol context.send(name) when Proc Avo::ExecutionContext.new(target: name, context: context).handle else name.to_s end end
def compute_path(element)
def compute_path(element) case path = element.path when Symbol context.send(path) when Proc Avo::ExecutionContext.new(target: path, context: context).handle else context.url_for(path) end end
def initialize(context, options)
def initialize(context, options) @context = context @options = options end
def render
def render separator = options.fetch(:separator, DEFAULT_SEPARATOR) breadcrumbs.map(&method(:render_element)).join(separator) end
def render_element(element)
def render_element(element) content = element.path.nil? ? compute_name(element) : context.link_to_unless_current(compute_name(element), compute_path(element)) options[:tag] ? context.content_tag(options[:tag], content) : ERB::Util.h(content) end