Class: HandyToolbox::MenuLoader

Inherits:
Menu
  • Object
show all
Defined in:
lib/handy_toolbox/menu_loader.rb

Constant Summary collapse

NOT_LOADED_YET_ICON =
' % '

Constants inherited from Menu

HandyToolbox::Menu::ICON

Instance Attribute Summary

Attributes inherited from Menu

#children, #id, #parent, #tools

Instance Method Summary collapse

Methods inherited from Menu

#menu, #menu_loader, #plugin, #to_s, #tool

Constructor Details

#initialize(parent, group, loader) ⇒ MenuLoader

Returns a new instance of MenuLoader.



6
7
8
9
10
# File 'lib/handy_toolbox/menu_loader.rb', line 6

def initialize(parent, group, loader)
  super(parent, group)
  @loader = loader
  @loaded = false
end

Instance Method Details

#iconObject



19
20
21
# File 'lib/handy_toolbox/menu_loader.rb', line 19

def icon
  @loaded ? super : NOT_LOADED_YET_ICON
end

#on_loadObject



12
13
14
15
16
17
# File 'lib/handy_toolbox/menu_loader.rb', line 12

def on_load
  if !@loaded
    @loader.on_load(self)
    @loaded = true
  end
end