Module: Ramenu
- Defined in:
- lib/ramenu.rb,
lib/ramenu/menus.rb,
lib/ramenu/config.rb,
lib/ramenu/railtie.rb,
lib/ramenu/version.rb,
lib/ramenu/ramenu_definer.rb,
lib/ramenu/ramenu_methods.rb,
lib/ramenu/action_controller.rb
Defined Under Namespace
Modules: ActionController, Menus, Version Classes: Configuration, Railtie, RamenuDefiner
Constant Summary collapse
Class Method Summary collapse
-
.add_menu(name, path, options = {}, &block) ⇒ Object
menus.
-
.add_menu_to(menu, name, path, options = {}, &block) ⇒ Object
add a new menu element to a set of menus.
-
.config ⇒ Object
Global settings for Ramenu.
-
.configure {|@config ||= Ramenu::Configuration.new| ... } ⇒ Object
Configures global settings for Ramenu.
-
.new_ramenu_element(name, path = nil, options = {}) {|elem| ... } ⇒ Object
create a new menu element.
-
.set_flag_in(flags, name, value, options = {}) ⇒ Object
add a new flag to a set of flags.
-
.static_flags(flagset = nil) ⇒ Object
flags.
-
.static_menus(menu = nil) ⇒ Object
return static menus.
Class Method Details
.add_menu(name, path, options = {}, &block) ⇒ Object
menus
36 37 38 39 |
# File 'lib/ramenu/ramenu_methods.rb', line 36 def self.(name, path, = {}, &block) = [:menu] ((), name, path, , &block) end |
.add_menu_to(menu, name, path, options = {}, &block) ⇒ Object
add a new menu element to a set of menus
22 23 24 |
# File 'lib/ramenu/ramenu_methods.rb', line 22 def self.(, name, path, = {}, &block) << (name, path, , &block) end |
.config ⇒ Object
Global settings for Ramenu
10 11 12 |
# File 'lib/ramenu/config.rb', line 10 def self.config @config end |
.configure {|@config ||= Ramenu::Configuration.new| ... } ⇒ Object
Configures global settings for Ramenu
5 6 7 |
# File 'lib/ramenu/config.rb', line 5 def self.configure(&block) yield @config ||= Ramenu::Configuration.new end |
.new_ramenu_element(name, path = nil, options = {}) {|elem| ... } ⇒ Object
create a new menu element
27 28 29 30 31 32 33 |
# File 'lib/ramenu/ramenu_methods.rb', line 27 def self.(name, path = nil, = {}, &block) [:flag] = name if [:flag_for_menu] == true && name.is_a?(Symbol) elem = Menus::Element.new(name, path, ) yield elem if block_given? return elem end |
.set_flag_in(flags, name, value, options = {}) ⇒ Object
add a new flag to a set of flags
18 19 20 |
# File 'lib/ramenu/ramenu_methods.rb', line 18 def self.set_flag_in(flags, name, value, = {}) flags.merge!({ name => value }) unless name.nil? || value.nil? end |
.static_flags(flagset = nil) ⇒ Object
flags
4 5 6 7 8 |
# File 'lib/ramenu/ramenu_methods.rb', line 4 def self.static_flags(flagset = nil) flagset = DEFAULT_GROUP if flagset.nil? @ramenu_flags ||= {} @ramenu_flags[flagset] ||= {} end |
.static_menus(menu = nil) ⇒ Object
return static menus
11 12 13 14 15 |
# File 'lib/ramenu/ramenu_methods.rb', line 11 def self.( = nil) = DEFAULT_GROUP if .nil? @ramenu_menus ||= {} @ramenu_menus[] ||= [] end |