Sha256: 0e440692b9144f00640fb3e91ca1e21be4393bafcfabf39dc975512d2f7b3726

Contents?: true

Size: 805 Bytes

Versions: 1

Compression:

Stored size: 805 Bytes

Contents

module DynamicMenu
  class Base
    
    def initialize(parent)
      @parent ||= parent
      @menuLinks = build_menu
    end
    
    def get_menu_links
      @menuLinks || AdvancedHash::AdvancedHash.new
    end
    
    def method_missing(method, *args)
      super unless @parent.methods.index method
      @parent.send(method, *args)
    end
    
    def inherit_from menu_name
      #@menuLinks ||= AdvancedHash::AdvancedHash.new
      file = Rails.root.to_s+"/app/menus/#{params[:controller]}/#{menu_name}.rb"
      load file
      links_obj = "#{menu_name}Menu".classify.constantize.new(@parent)
      @menuLinks = @menuLinks.merge(links_obj.get_menu_links)
    end
    
    def menu_instance
      @menuLinks ||= AdvancedHash::AdvancedHash.new
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dynamic_menu-3.0.0.rc2 lib/dynamic_menu/base.rb