Module: Menu

Defined in:
lib/menu/worktime/intervaltime_menu.rb,
lib/menu/menu.rb,
lib/menu/base_menu.rb,
lib/menu/main_menu.rb,
lib/menu/adapter_menu.rb,
lib/menu/person_option.rb,
lib/menu/entity_queries.rb,
lib/menu/database_option.rb,
lib/menu/entity_addition.rb,
lib/menu/worktime/time_menu.rb,
lib/menu/worktime/weektime_menu.rb,
lib/menu/worktime/monthtime_menu.rb,
lib/menu/worktime/customtime_menu.rb,
lib/menu/worktime/worktime_queries.rb

Overview

This module holds the classes for the terminal menu, which can be used to run this program in a terminal window.

Defined Under Namespace

Modules: TimeMenu Classes: AdapterMenu, Base, DatabaseOption, EntityAddition, EntityQueries, MainMenu, PersonOption, WorktimeQueries

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.data_handlerBaseHandler (readonly)

Returns the handler for the data storage.

Returns:

  • (BaseHandler)

    the handler for the data storage



10
11
12
# File 'lib/menu/menu.rb', line 10

def data_handler
  @data_handler
end

Class Method Details

.exit_scriptObject

method to end the script without saving any data



20
21
22
23
# File 'lib/menu/menu.rb', line 20

def self.exit_script
  puts "Shutting down...".yellow
  exit(0)
end

.initialize_datahandler(data_handler) ⇒ Object

method to set a new data handler

Parameters:

  • data_handler (DataHandler)

    the given data handler



15
16
17
# File 'lib/menu/menu.rb', line 15

def self.initialize_datahandler(data_handler)
  @data_handler = data_handler
end

.parse_date(string) ⇒ Time

method to parse a date from a given string

Parameters:

  • string (String)

    the string with the data

Returns:

  • (Time)

    the newly created tme object



28
29
30
31
# File 'lib/menu/menu.rb', line 28

def self.parse_date(string)
  time = string.split("-")
  Time.new(time[0], time[1], time[2],time[3],time[4])
end