Class: Cliptic::Terminal::Command
- Inherits:
-
Object
- Object
- Cliptic::Terminal::Command
- Defined in:
- lib/cliptic/terminal.rb
Class Method Summary collapse
- .close ⇒ Object
- .main_menu ⇒ Object
- .parse_args ⇒ Object
- .play(offset) ⇒ Object
- .run ⇒ Object
- .setup ⇒ Object
Class Method Details
.close ⇒ Object
33 34 35 36 |
# File 'lib/cliptic/terminal.rb', line 33 def self.close Curses.close_screen puts "Thanks for playing!" end |
.main_menu ⇒ Object
18 19 20 21 |
# File 'lib/cliptic/terminal.rb', line 18 def self. setup Cliptic::Menus::Main.new.choose_opt end |
.parse_args ⇒ Object
22 23 24 25 26 27 |
# File 'lib/cliptic/terminal.rb', line 22 def self.parse_args case arg = ARGV.shift when "reset", "-r" then Reset_Stats.route.call when "today", "-t" then play(ARGV.shift.to_i) end end |
.play(offset) ⇒ Object
28 29 30 31 32 |
# File 'lib/cliptic/terminal.rb', line 28 def self.play(offset) setup Cliptic::Main::Player:: Game.new(date:Date.today+offset).play end |
.run ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/cliptic/terminal.rb', line 4 def self.run ARGV.size > 0 ? parse_args : rescue StandardError => e Curses.close_screen abort(e.) end |