Class: MisterBin::Terminal
- Inherits:
-
Object
- Object
- MisterBin::Terminal
- Includes:
- Colsole
- Defined in:
- lib/mister_bin/terminal.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#runner ⇒ Object
readonly
Returns the value of attribute runner.
Instance Method Summary collapse
-
#initialize(runner, options = nil) ⇒ Terminal
constructor
A new instance of Terminal.
- #on(command, &block) ⇒ Object
- #start ⇒ Object
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, = nil) @runner = runner @options = || {} end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/mister_bin/terminal.rb', line 9 def @options end |
#runner ⇒ Object (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 |
#start ⇒ Object
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 loop { break unless safe_input_loop } end |