class Resty::Repl

Attributes

interrupted[RW]
options[RW]

Public Class Methods

new(resty_options) click to toggle source
# File lib/resty/repl.rb, line 10
def initialize(resty_options)
  @options = Resty::Options.new(resty_options)

  Pry.config.prompt = [ proc { "resty> " }, proc { "*>" }]
  Pry.config.history.file = "~/.ruby_resty_history"
  Pry.config.print = proc do |output, value|
    output = Resty::PrettyPrinter.new(options, value).generate
    begin
      output.is_a?(String) ? stagger_output(output) : stagger_output(output.pretty_inspect)
    rescue Exception
      output.puts(output)
    end
  end
end
start(resty_options) click to toggle source
# File lib/resty/repl.rb, line 25
def self.start(resty_options)
  new(resty_options).tap do |repl|
    Pry.config.input = repl
    repl.options.pry
  end
end

Public Instance Methods

readline(current_prompt) click to toggle source
# File lib/resty/repl.rb, line 32
def readline(current_prompt)
  Readline.readline(current_prompt)
end