Sha256: 19433c2b88a818c1b1112b9e4f46ec5512025773980ffc11c43cf027f6c99dc5
Contents?: true
Size: 586 Bytes
Versions: 4
Compression:
Stored size: 586 Bytes
Contents
module MenuBuilder module ViewHelpers class Menu def initialize(context) @context = context @menu_item = @context.instance_variable_get('@menu_item') end def current_item?(item) @menu_item.to_s == item.to_s end def method_missing(item, *args, &block) css_class = "current" if current_item?(item) @context.content_tag :li, @context.link_to(*args, &block), :class=>css_class end end def menu(options={}, &block) content_tag :ul, capture(Menu.new(self), &block), options end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
menu_builder-0.3.3 | lib/menu_builder/helper.rb |
menu_builder-0.3.2 | lib/menu_builder/helper.rb |
menu_builder-0.3.1 | lib/menu_builder/helper.rb |
menu_builder-0.3.0 | lib/menu_builder/helper.rb |