Class: Root_Menu
Instance Attribute Summary collapse
Attributes inherited from Menu
#name, #path, #style
Instance Method Summary
collapse
Methods inherited from Menu
#get_font_string, #items, #remove_item, #set_item, #show_menu, #to_s
Methods included from Item
#name, #name=
Constructor Details
#initialize(history_length = 1000, history_items = 5) ⇒ Root_Menu
Returns a new instance of Root_Menu.
8
9
10
11
12
13
|
# File 'lib/root_menu.rb', line 8
def initialize history_length = 1000, history_items = 5
super "Dynmenu"
self. = true
@history = History.new history_length, history_items
set_item Run_Menu.new self, @history
end
|
Instance Attribute Details
#history ⇒ Object
Returns the value of attribute history.
6
7
8
|
# File 'lib/root_menu.rb', line 6
def history
@history
end
|
Sets the attribute run_menu
5
6
7
|
# File 'lib/root_menu.rb', line 5
def (value)
@run_menu = value
end
|
Instance Method Details
#encode_with(coder) ⇒ Object
35
36
37
38
39
|
# File 'lib/root_menu.rb', line 35
def encode_with coder
super
coder['run_menu'] = @run_menu
coder['history'] = @history
end
|
#execute ⇒ Object
15
16
17
18
19
20
21
|
# File 'lib/root_menu.rb', line 15
def execute
if $launcher
return Run_Menu.new(self, @history).execute unless @run_menu
@items.each_value {|item| return item.execute if item.is_a? Run_Menu}
end
super
end
|
#filter_entries(entries) ⇒ Object
26
27
28
29
30
31
32
33
|
# File 'lib/root_menu.rb', line 26
def filter_entries entries
partitions = super.partition {|entry| @items[entry].is_a?(Run_Menu)}
if
partitions[0] + partitions[1]
else
partitions[1]
end
end
|
#init_with(coder) ⇒ Object
41
42
43
44
45
46
|
# File 'lib/root_menu.rb', line 41
def init_with coder
super
@run_menu = coder['run_menu']
@history = coder['history']
set_item Run_Menu.new self, @history if @run_menu
end
|
22
23
24
|
# File 'lib/root_menu.rb', line 22
def
@run_menu
end
|