Sha256: 6c27295779ae49d8f89b780ba1d1433bb3db2a04adddcf55a4c7049ee9b9ad20
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
module DynamicMenu class Base def initialize(parent) @parent ||= parent load_instance_vars @menuLinks = AdvancedArray.new build_menu end def get_menu_links @menuLinks || AdvancedArray.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.concat(links_obj.get_menu_links) end def load_instance_vars @parent.instance_variables.each do |var| instance_variable_set(var.intern,@parent.instance_variable_get(var.intern)) end end def menu_instance @menuLinks ||= AdvancedArray.new end def add *args args.each do |arg| @menuLinks << arg end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dynamic_menu-3.0.1 | lib/dynamic_menu/base.rb |
dynamic_menu-3.0.0 | lib/dynamic_menu/base.rb |