2011-06-02 11:22:59 -04:00
|
|
|
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
2011-01-21 01:09:21 -05:00
|
|
|
|
|
|
|
# Create a StringIO that contains the input data for all the Pry objects
|
|
|
|
cmds = <<-CMDS
|
|
|
|
cd 1
|
|
|
|
status
|
|
|
|
puts 'hello from 1!!'
|
|
|
|
cd 2
|
|
|
|
nesting
|
|
|
|
puts 'hello from 2!!'
|
|
|
|
_pry_.parent.input = Readline
|
|
|
|
back
|
2011-02-16 16:22:59 -05:00
|
|
|
exit-all
|
2011-01-21 01:09:21 -05:00
|
|
|
CMDS
|
2011-01-21 04:17:12 -05:00
|
|
|
|
|
|
|
# create our StringIO object
|
2011-01-21 01:09:21 -05:00
|
|
|
str_input = StringIO.new(cmds)
|
|
|
|
|
2011-01-21 04:17:12 -05:00
|
|
|
# set global input to str_input, this means that all pry sessions
|
|
|
|
# adopt this object as their input object.
|
2011-01-21 01:09:21 -05:00
|
|
|
Pry.input = str_input
|
|
|
|
|
|
|
|
# Start the session reading from str_input.
|
|
|
|
# Note that because `Pry.input` is set to `str_input` all nested pry
|
|
|
|
# sessions will read from `str_input` too. All pry sessions are there
|
|
|
|
# for non-interactive, except for `pry(1)` which starts off
|
|
|
|
# non-interactive but is set to be interactive by pry(2) (using
|
|
|
|
# _pry_.parent.input = Readline)
|
|
|
|
0.pry
|