Class: Electr::BaseReader
- Inherits:
-
Object
- Object
- Electr::BaseReader
- Defined in:
- lib/electr/repl/base_reader.rb
Overview
Responsible of the terminal interface, that is printing the prompt and reading a line of code (I know, I know, there is an «and» in the description…). This is a base class intended for inheritance.
Instance Method Summary collapse
-
#initialize(prompt = "No prompt defined> ", readline_lib = Readline) ⇒ BaseReader
constructor
Creates a new BaseReader.
- #run ⇒ Object
Constructor Details
#initialize(prompt = "No prompt defined> ", readline_lib = Readline) ⇒ BaseReader
Creates a new BaseReader.
prompt - String prompt to be displayed to the user. readline_lib - The app should always use Readline, but injected
the Module here could ease the tests…
13 14 15 16 17 |
# File 'lib/electr/repl/base_reader.rb', line 13 def initialize(prompt = "No prompt defined> ", readline_lib = Readline) @prompt = prompt @readline = readline_lib end |
Instance Method Details
#run ⇒ Object
19 20 21 |
# File 'lib/electr/repl/base_reader.rb', line 19 def run raise(NotImplementedError) end |