Sha256: 174b218445ea812d648ce3d49a73984074690975ae7416a01de4df4c0854da53

Contents?: true

Size: 493 Bytes

Versions: 4

Compression:

Stored size: 493 Bytes

Contents

module MenuBuilder
  module Controller
    extend ActiveSupport::Concern

    def menu_items(*items)
      instance_variable_set('@menu_items', items)
    end
    alias_method :menu_item, :menu_items

    module ClassMethods
      def menu_items(*items)
        options = items.extract_options!

        before_filter(options) do |controller|
          controller.instance_variable_set('@menu_items', items)
        end
      end
      alias_method :menu_item, :menu_items

    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
menu_builder-0.4.3 lib/menu_builder/controller.rb
menu_builder-0.4.2 lib/menu_builder/controller.rb
menu_builder-0.4.1 lib/menu_builder/controller.rb
menu_builder-0.4.0 lib/menu_builder/controller.rb