Class: Menu::IndexSelectionMenu
- Includes:
- Listenable
- Defined in:
- lib/menu/index_menus/index_selection_menu.rb
Overview
menu class that inherits Base to abstract the menu to select a given status
Instance Attribute Summary
Attributes inherited from Base
#menu_description, #menu_items
Instance Method Summary collapse
-
#define_menu_items ⇒ Object
private
implementation to define the items of the menu.
-
#determine_action(input) ⇒ Object
private
method to specify the actions to a given input.
-
#initialize ⇒ IndexSelectionMenu
constructor
initialization.
Methods included from Listenable
#add_listener, #listeners, #notify_listeners, #remove_listener
Methods inherited from Base
#add_menu_item, #get_entry, #handle_wrong_option, #print_menu
Constructor Details
#initialize ⇒ IndexSelectionMenu
initialization
9 10 11 12 |
# File 'lib/menu/index_menus/index_selection_menu.rb', line 9 def initialize @menu_description = "Index overview. Select the criteria for the index:" super end |
Instance Method Details
#define_menu_items ⇒ Object (private)
implementation to define the items of the menu
17 18 19 20 21 22 |
# File 'lib/menu/index_menus/index_selection_menu.rb', line 17 def ("Http request", 1) ("Http status", 2) ("Sourceadress", 3) ("Timestamp", 4) end |
#determine_action(input) ⇒ Object (private)
method to specify the actions to a given input
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/menu/index_menus/index_selection_menu.rb', line 26 def determine_action(input) case (input.to_i) when 1 then notify_listeners(:change_index, :http_request) when 2 then notify_listeners(:change_index, :http_status) when 3 then notify_listeners(:change_index, :source) when 4 then notify_listeners(:change_index, :timestamp) else handle_wrong_option end end |