mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
almost ready for 0.4.0 release, created new example_input2.rb example for advanced input usage
This commit is contained in:
parent
c8b05f54e0
commit
45f2f105f8
4 changed files with 48 additions and 1 deletions
10
CHANGELOG
10
CHANGELOG
|
@ -1,3 +1,13 @@
|
|||
21/1/2010 version 0.4.0
|
||||
* added command API
|
||||
* added many new commands, i.e ls_methods and friends
|
||||
* modified other commands
|
||||
* now accepts greater customization, can modify: input, output, hooks,
|
||||
prompt, print object
|
||||
* added tab completion (even completes commands)
|
||||
* added extensive tests
|
||||
* added examples
|
||||
* many more changes
|
||||
9/12/2010 version 0.1.3
|
||||
* Got rid of rubygems dependency, refactored some code.
|
||||
8/12/2010 version 0.1.2
|
||||
|
|
|
@ -242,6 +242,12 @@ If you want to access a method of the same name, prefix the invocation by whites
|
|||
current one with `obj` as the receiver of the new session. Very useful
|
||||
when exploring large or complicated runtime state.
|
||||
|
||||
Example Programs
|
||||
----------------
|
||||
|
||||
Pry comes bundled with a few example programs to illustrate some
|
||||
features, see the `examples/` directory.
|
||||
|
||||
Customizing Pry
|
||||
---------------
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class WinClass < Gosu::Window
|
|||
|
||||
def initialize
|
||||
super(WIDTH, HEIGHT, false)
|
||||
@img = TexPlay.create_image(self, 200, 200)
|
||||
@img = TexPlay.create_image(self, 200, 200).clear :color => :black
|
||||
@img.rect 0, 0, @img.width - 1, @img.height - 1
|
||||
|
||||
@binding = @img.__binding__
|
||||
|
|
31
examples/example_input2.rb
Normal file
31
examples/example_input2.rb
Normal file
|
@ -0,0 +1,31 @@
|
|||
direc = File.dirname(__FILE__)
|
||||
|
||||
require 'rubygems'
|
||||
require "#{direc}/../lib/pry"
|
||||
|
||||
# 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
|
||||
exit_all
|
||||
CMDS
|
||||
str_input = StringIO.new(cmds)
|
||||
|
||||
# Start a Pry session on the Fixnum 5 using the input data in
|
||||
# str_input
|
||||
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
|
Loading…
Reference in a new issue