Class: Meshchat::Ui::CLI::ReadlineInput
- Inherits:
-
Object
- Object
- Meshchat::Ui::CLI::ReadlineInput
- Defined in:
- lib/meshchat/ui/cli/readline_input.rb
Defined Under Namespace
Modules: Handler
Class Attribute Summary collapse
-
.input_handler ⇒ Object
Returns the value of attribute input_handler.
Instance Attribute Summary collapse
-
#_input_receiver ⇒ Object
readonly
The class used for interpeting the line input.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(input_receiver) ⇒ ReadlineInput
constructor
A new instance of ReadlineInput.
- #start ⇒ Object
Constructor Details
#initialize(input_receiver) ⇒ ReadlineInput
Returns a new instance of ReadlineInput.
11 12 13 |
# File 'lib/meshchat/ui/cli/readline_input.rb', line 11 def initialize(input_receiver) @_input_receiver = input_receiver end |
Class Attribute Details
.input_handler ⇒ Object
Returns the value of attribute input_handler.
57 58 59 |
# File 'lib/meshchat/ui/cli/readline_input.rb', line 57 def input_handler @input_handler end |
Instance Attribute Details
#_input_receiver ⇒ Object (readonly)
The class used for interpeting the line input
9 10 11 |
# File 'lib/meshchat/ui/cli/readline_input.rb', line 9 def _input_receiver @_input_receiver end |
Class Method Details
Instance Method Details
#start ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/meshchat/ui/cli/readline_input.rb', line 62 def start # Ripl.start conn = EventMachine.watch $stdin, Handler conn.notify_readable = true conn.input_receiver = _input_receiver self.class.input_handler = conn # update auto completion completion = proc { |s| self.class.autocompletes.grep(/^#{Regexp.escape(s)}/) } Readline.completion_proc = completion end |