module Crumby::Helper::ControllerHelper

controller helper

Public Instance Methods

add_crumby(*args) click to toggle source

render trail @see Crumby::Trail#render @see Crumby::Renderer::Base @overload crumby(options)

@param [Hash] options passthrough to Trail#render
@option options [String, Symbol] :scope extract scope from options before passthrough

@overload crumby(scope, options)

@param [Symbol, String] scope scope of trail
@param [Hash] options passthrough to Trail#render
@option options [String, Symbol] :scope extract scope from options before passthrough
# File lib/crumby/helper/controller.rb, line 31
def add_crumby(*args)
  options = args.extract_options!
  scope = options.delete(:scope) || :default
  crumby_trail(scope).add(*args, options)
end
crumby_title(*args) click to toggle source

render trail @see Crumby::Trail#title @overload crumby(options)

@param [Hash] options passthrough to Crumby::Trail#title
@option options [String, Symbol] :scope extract scope from options before passthrough

@overload crumby(suffix, options)

@param [String] suffix passthrough to Crumby::Trail#title
@param [Hash] options passthrough to Crumby::Trail#title
@option options [String, Symbol] :scope extract scope from options before passthrough
# File lib/crumby/helper/controller.rb, line 47
def crumby_title(*args)
  options = args.extract_options!
  scope = options.delete(:scope) || :default
  crumby_trail(scope).title(*args, options)
end
crumby_trail(scope = :default) click to toggle source

return crumby_trail by scope @param [Symbol, String] scope

# File lib/crumby/helper/controller.rb, line 14
def crumby_trail(scope = :default)
  raise ArgumentError if scope.nil?
  scope = scope.to_sym
  @crumby_trails = {} if @crumby_trails.nil?
  @crumby_trails[scope] ||= Crumby::Trail.new
end