Class: MisterBin::Terminal

Inherits:
Object
  • Object
show all
Includes:
Colsole
Defined in:
lib/mister_bin/terminal.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(runner, options = nil) ⇒ Terminal

Returns a new instance of Terminal.



11
12
13
14
# File 'lib/mister_bin/terminal.rb', line 11

def initialize(runner, options = nil)
  @runner = runner
  @options = options || {}
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/mister_bin/terminal.rb', line 9

def options
  @options
end

#runnerObject (readonly)

Returns the value of attribute runner.



9
10
11
# File 'lib/mister_bin/terminal.rb', line 9

def runner
  @runner
end

Instance Method Details

#on(command, &block) ⇒ Object



16
17
18
# File 'lib/mister_bin/terminal.rb', line 16

def on(command, &block)
  reserved_commands[command] = block
end

#startObject



20
21
22
23
24
25
26
# File 'lib/mister_bin/terminal.rb', line 20

def start
  Readline.completion_append_character = ' '
  Readline.completion_proc = autocomplete_handler if autocomplete

  welcome_messages
  loop { break unless safe_input_loop }
end