Class: Ramenu::RamenuDefiner
- Inherits:
-
Object
- Object
- Ramenu::RamenuDefiner
- Defined in:
- lib/ramenu/ramenu_definer.rb
Overview
A menu definer to create menus in a block
Instance Attribute Summary collapse
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#menus ⇒ Object
Returns the value of attribute menus.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#add_menu(name, path = nil, options = {}, &block) ⇒ Object
create a new menu in a block.
-
#initialize(menus, flags, options = {}) ⇒ RamenuDefiner
constructor
A new instance of RamenuDefiner.
-
#set_flag(name, value = nil, options = {}) ⇒ Object
create a new flag in a block.
Constructor Details
#initialize(menus, flags, options = {}) ⇒ RamenuDefiner
Returns a new instance of RamenuDefiner.
6 7 8 9 10 |
# File 'lib/ramenu/ramenu_definer.rb', line 6 def initialize(, flags, = {}) self. = self.flags = flags self. = end |
Instance Attribute Details
#flags ⇒ Object
Returns the value of attribute flags.
4 5 6 |
# File 'lib/ramenu/ramenu_definer.rb', line 4 def flags @flags end |
#menus ⇒ Object
Returns the value of attribute menus.
4 5 6 |
# File 'lib/ramenu/ramenu_definer.rb', line 4 def @menus end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/ramenu/ramenu_definer.rb', line 4 def @options end |
Instance Method Details
#add_menu(name, path = nil, options = {}, &block) ⇒ Object
create a new menu in a block
18 19 20 21 |
# File 'lib/ramenu/ramenu_definer.rb', line 18 def (name, path = nil, = {}, &block) [:flag_for_menu] = true if @options[:flag_for_menu] == true Ramenu.(, name, path, , &block) end |
#set_flag(name, value = nil, options = {}) ⇒ Object
create a new flag in a block
13 14 15 |
# File 'lib/ramenu/ramenu_definer.rb', line 13 def set_flag(name, value = nil, = {}) Ramenu.set_flag_in(flags, name, value, ) end |