Class: Groonga::Client::CommandLine::GroongaClient::ReadlineREPL

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga/client/command-line/groonga-client.rb

Instance Method Summary collapse

Constructor Details

#initialize(runner) ⇒ ReadlineREPL

Returns a new instance of ReadlineREPL.



201
202
203
204
205
# File 'lib/groonga/client/command-line/groonga-client.rb', line 201

def initialize(runner)
  @runner = runner
  @history_path = guess_history_path
  read_history
end

Instance Method Details

#runObject



207
208
209
210
211
212
213
214
215
# File 'lib/groonga/client/command-line/groonga-client.rb', line 207

def run
  loop do
    line = Readline.readline("> ", true)
    break if line.nil?
    add_history(line)
    @runner << line
    @runner << "\n"
  end
end