Class: Resty::Repl
- Inherits:
-
Object
- Object
- Resty::Repl
- Includes:
- Pry::Helpers::BaseHelpers, Readline
- Defined in:
- lib/resty/repl.rb
Instance Attribute Summary collapse
-
#interrupted ⇒ Object
Returns the value of attribute interrupted.
-
#options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(resty_options) ⇒ Repl
constructor
A new instance of Repl.
- #readline(current_prompt) ⇒ Object
Constructor Details
#initialize(resty_options) ⇒ Repl
Returns a new instance of Repl.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/resty/repl.rb', line 10 def initialize() @options = Resty::Options.new() Pry.config.prompt = [ proc { "resty> " }, proc { "*>" }] Pry.config.history.file = "~/.ruby_resty_history" Pry.config.print = proc do |output, value| output = Resty::PrettyPrinter.new(, value).generate begin output.is_a?(String) ? stagger_output(output) : stagger_output(output.pretty_inspect) rescue Exception output.puts(output) end end end |
Instance Attribute Details
#interrupted ⇒ Object
Returns the value of attribute interrupted.
8 9 10 |
# File 'lib/resty/repl.rb', line 8 def interrupted @interrupted end |
#options ⇒ Object
Returns the value of attribute options.
8 9 10 |
# File 'lib/resty/repl.rb', line 8 def @options end |
Class Method Details
.start(resty_options) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/resty/repl.rb', line 25 def self.start() new().tap do |repl| Pry.config.input = repl repl..pry end end |
Instance Method Details
#readline(current_prompt) ⇒ Object
32 33 34 |
# File 'lib/resty/repl.rb', line 32 def readline(current_prompt) Readline.readline(current_prompt) end |