Module: Crummy::ViewMethods
- Defined in:
- lib/crummy/action_view.rb
Instance Method Summary collapse
-
#add_crumb(name, url = nil, options = {}) ⇒ Object
Add a crumb to the
crumbs
array. -
#crumbs ⇒ Object
List the crumbs as an array.
-
#render_crumbs(options = {}) ⇒ Object
Render the list of crumbs using renderer.
Instance Method Details
#add_crumb(name, url = nil, options = {}) ⇒ Object
Add a crumb to the crumbs
array
9 10 11 |
# File 'lib/crummy/action_view.rb', line 9 def add_crumb(name, url=nil, ={}) crumbs.push [name, url, ] end |
#crumbs ⇒ Object
List the crumbs as an array
4 5 6 |
# File 'lib/crummy/action_view.rb', line 4 def crumbs @_crumbs ||= [] # Give me something to push to end |
#render_crumbs(options = {}) ⇒ Object
Render the list of crumbs using renderer
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/crummy/action_view.rb', line 15 def render_crumbs( = {}) raise ArgumentError, "Renderer and block given" if .has_key?(:renderer) && block_given? return yield(crumbs, ) if block_given? @_renderer ||= if .has_key?(:renderer) .delete(:renderer) else require 'crummy/standard_renderer' Crummy::StandardRenderer.new end @_renderer.render_crumbs(crumbs, ) end |