Class: Electr::BaseReader

Inherits:
Object
  • Object
show all
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.

Direct Known Subclasses

ASTReader, Reader

Instance Method Summary collapse

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

#runObject

Raises:

  • (NotImplementedError)


19
20
21
# File 'lib/electr/repl/base_reader.rb', line 19

def run
  raise(NotImplementedError)
end