Class: Main

Inherits:
Object
  • Object
show all
Defined in:
app/main.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arg) ⇒ Main

Returns a new instance of Main.



6
7
8
9
10
# File 'app/main.rb', line 6

def initialize(arg)
  self.arg = arg

  raise 'Cannot run nested Tmux session' if commander.in_tmux?
end

Instance Attribute Details

#argObject

Returns the value of attribute arg.



4
5
6
# File 'app/main.rb', line 4

def arg
  @arg
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/main.rb', line 12

def run
  Curses.crmode

  state = initial_state
  window = display(state)

  begin
    loop do
      state = set_next_screen(window, state)
      window = display(state)
    end
  rescue ExitAction
    logger.info("Exiting")
  rescue Interrupt => exception
    logger.info("Interrupted: exiting application")
  rescue => exception
    logger.error(exception)
    logger.error(exception.backtrace)
  ensure
    Curses.close_screen
  end
end