Sha256: 62cd7ccea358d6c68abf136945b65b0d730e088d8bc7246e305bb1312e58b50b

Contents?: true

Size: 634 Bytes

Versions: 1

Compression:

Stored size: 634 Bytes

Contents

require 'singleton'

module AdminFu

  mattr_accessor :route_namespace
  
  #defaults
  @route_namespace = :admin_fu

  class Menu < Hash
    include Singleton

    class Entry < Hash
      attr_accessor :path

      def initialize(path)
        @path = path
      end

      def action(action, path)
        store(action, path)
      end
    end

    def entry(name, path = nil)
      store(name, Entry.new(path))
    end
  end

  def self.menu(&block)
    if block_given?
      AdminFu::Menu.instance.instance_eval(&block)
    end

    AdminFu::Menu.instance
  end

  def self.clear_menu()
    AdminFu::Menu.instance.clear
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
admin_fu-0.1.0 lib/admin_fu/config.rb