Class: IntervalMenu

Inherits:
Base
  • Object
show all
Includes:
Listenable
Defined in:
lib/menu/time_menus/interval_menu.rb

Overview

menu class that inherits Menu::Base to create a menu for selecting time intervals

Instance Method Summary collapse

Methods included from Listenable

#add_listener, #listeners, #notify_listeners, #remove_listener

Constructor Details

#initializeIntervalMenu

initialization



7
8
9
10
# File 'lib/menu/time_menus/interval_menu.rb', line 7

def initialize
  super
  @menu_description = "Interval selection menu. Specify a time interval:"
end

Instance Method Details

#define_menu_itemsObject (private)

implementation to define the items of the menu



15
16
17
18
19
20
# File 'lib/menu/time_menus/interval_menu.rb', line 15

def define_menu_items
  add_menu_item("This month.", 1)
  add_menu_item("This week.", 2)
  add_menu_item("Custom interval.", 3)
  add_menu_item("Return to previous menu.", 4)
end

#determine_action(input) ⇒ Object (private)

method to specify the actions to a given input

Parameters:

  • input (String)

    the user input



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/menu/time_menus/interval_menu.rb', line 24

def determine_action(input)
  case (input.to_i)
    when 1
      # create month time interval
    when 2
      # create week interval
    when 3
      # create custom interval
    when 3 then return
  end
end