pry 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -0
- data/examples/example_basic.rb +17 -0
- data/examples/example_image_edit.rb +8 -6
- data/lib/pry/commands.rb +2 -2
- data/lib/pry/version.rb +1 -1
- metadata +48 -81
data/README.markdown
CHANGED
@@ -286,6 +286,7 @@ Example Programs
|
|
286
286
|
Pry comes bundled with a few example programs to illustrate some
|
287
287
|
features, see the `examples/` directory.
|
288
288
|
|
289
|
+
* `example_basic.rb` - Demonstrate basic Pry functionality
|
289
290
|
* `example_input.rb` - Demonstrates how to set the `input` object.
|
290
291
|
* `example_output.rb` - Demonstrates how to set the `output` object.
|
291
292
|
* `example_hooks.rb` - Demonstrates how to set the `hooks` hash.
|
@@ -0,0 +1,17 @@
|
|
1
|
+
direc = File.dirname(__FILE__)
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require "#{direc}/../lib/pry"
|
5
|
+
|
6
|
+
# define a local.
|
7
|
+
a = "a local variable"
|
8
|
+
|
9
|
+
# defing a top-level method.
|
10
|
+
def hello
|
11
|
+
puts "hello world!"
|
12
|
+
end
|
13
|
+
|
14
|
+
# Start pry session at top-level.
|
15
|
+
# The local variable `a` and the `hello` method will
|
16
|
+
# be accessible.
|
17
|
+
pry
|
@@ -38,16 +38,16 @@ class WinClass < Gosu::Window
|
|
38
38
|
|
39
39
|
def initialize
|
40
40
|
super(WIDTH, HEIGHT, false)
|
41
|
-
|
42
|
-
|
41
|
+
$img = TexPlay.create_image(self, 200, 200).clear :color => :black
|
42
|
+
$img.rect 0, 0, $img.width - 1, $img.height - 1
|
43
43
|
|
44
|
-
@binding =
|
44
|
+
@binding = $img.__binding__
|
45
45
|
|
46
46
|
@pry_instance = Pry.new(:commands => ImageCommands, :prompt => IMAGE_PROMPT)
|
47
47
|
end
|
48
48
|
|
49
49
|
def draw
|
50
|
-
|
50
|
+
$img.draw_rot(WIDTH / 2, HEIGHT / 2, 1, 0, 0.5, 0.5)
|
51
51
|
end
|
52
52
|
|
53
53
|
def update
|
@@ -57,7 +57,7 @@ class WinClass < Gosu::Window
|
|
57
57
|
# being updated; instead we do a REP session, and let the image
|
58
58
|
# update each time the user presses enter. We maintain the same
|
59
59
|
# binding object to keep locals between calls to `Pry#rep()`
|
60
|
-
@pry_instance.rep(@binding)
|
60
|
+
# @pry_instance.rep(@binding)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
@@ -66,5 +66,7 @@ puts "--"
|
|
66
66
|
puts "Example: Try typing 'circle width/2, height/2, 95, :color => :blue, :fill => true'"
|
67
67
|
puts "If you want to save your image, type: save(\"img.png\")"
|
68
68
|
|
69
|
-
WinClass.new
|
69
|
+
w = WinClass.new
|
70
|
+
Thread.new { Pry.start(w) }
|
71
|
+
w.show
|
70
72
|
|
data/lib/pry/commands.rb
CHANGED
@@ -57,10 +57,10 @@ class Pry
|
|
57
57
|
|
58
58
|
case target_self
|
59
59
|
when Module
|
60
|
-
c = with_constants ? target_self.constants : []
|
60
|
+
c = with_constants ? target_self.constants.inspect : [].inspect
|
61
61
|
output.puts "#{Pry.view(target.eval("local_variables + instance_variables + #{c}"))}"
|
62
62
|
else
|
63
|
-
c = with_constants ? target_self.class.constants : []
|
63
|
+
c = with_constants ? target_self.class.constants.inspect : [].inspect
|
64
64
|
output.puts "#{Pry.view(target.eval("local_variables + instance_variables + #{c}"))}"
|
65
65
|
end
|
66
66
|
end
|
data/lib/pry/version.rb
CHANGED
metadata
CHANGED
@@ -1,80 +1,56 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 4
|
9
|
-
- 6
|
10
|
-
version: 0.4.6
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.7
|
5
|
+
prerelease: !!null
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- John Mair (banisterfiend)
|
14
|
-
autorequire:
|
9
|
+
autorequire: !!null
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-02-12 00:00:00.000000000 +13:00
|
13
|
+
default_executable: !!null
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: ruby_parser
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &17387916 !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 5
|
30
|
-
segments:
|
31
|
-
- 2
|
32
|
-
- 0
|
33
|
-
- 5
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
34
22
|
version: 2.0.5
|
35
23
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: method_source
|
39
24
|
prerelease: false
|
40
|
-
|
25
|
+
version_requirements: *17387916
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: method_source
|
28
|
+
requirement: &17387628 !ruby/object:Gem::Requirement
|
41
29
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
hash: 23
|
46
|
-
segments:
|
47
|
-
- 0
|
48
|
-
- 2
|
49
|
-
- 0
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
50
33
|
version: 0.2.0
|
51
34
|
type: :runtime
|
52
|
-
version_requirements: *id002
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: bacon
|
55
35
|
prerelease: false
|
56
|
-
|
36
|
+
version_requirements: *17387628
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: bacon
|
39
|
+
requirement: &17387328 !ruby/object:Gem::Requirement
|
57
40
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
hash: 19
|
62
|
-
segments:
|
63
|
-
- 1
|
64
|
-
- 1
|
65
|
-
- 0
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
66
44
|
version: 1.1.0
|
67
45
|
type: :development
|
68
|
-
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *17387328
|
69
48
|
description: attach an irb-like session to any object at runtime
|
70
49
|
email: jrmair@gmail.com
|
71
50
|
executables: []
|
72
|
-
|
73
51
|
extensions: []
|
74
|
-
|
75
52
|
extra_rdoc_files: []
|
76
|
-
|
77
|
-
files:
|
53
|
+
files:
|
78
54
|
- lib/pry/commands.rb
|
79
55
|
- lib/pry/command_base.rb
|
80
56
|
- lib/pry/completion.rb
|
@@ -86,6 +62,7 @@ files:
|
|
86
62
|
- lib/pry/pry_instance.rb
|
87
63
|
- lib/pry/version.rb
|
88
64
|
- lib/pry.rb
|
65
|
+
- examples/example_basic.rb
|
89
66
|
- examples/example_commands.rb
|
90
67
|
- examples/example_command_override.rb
|
91
68
|
- examples/example_hooks.rb
|
@@ -102,39 +79,29 @@ files:
|
|
102
79
|
- README.markdown
|
103
80
|
- Rakefile
|
104
81
|
- .gemtest
|
105
|
-
has_rdoc:
|
82
|
+
has_rdoc: true
|
106
83
|
homepage: http://banisterfiend.wordpress.com
|
107
84
|
licenses: []
|
108
|
-
|
109
|
-
post_install_message:
|
85
|
+
post_install_message: !!null
|
110
86
|
rdoc_options: []
|
111
|
-
|
112
|
-
require_paths:
|
87
|
+
require_paths:
|
113
88
|
- lib
|
114
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
90
|
none: false
|
116
|
-
requirements:
|
117
|
-
- -
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
|
120
|
-
|
121
|
-
- 0
|
122
|
-
version: "0"
|
123
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
96
|
none: false
|
125
|
-
requirements:
|
126
|
-
- -
|
127
|
-
- !ruby/object:Gem::Version
|
128
|
-
|
129
|
-
segments:
|
130
|
-
- 0
|
131
|
-
version: "0"
|
97
|
+
requirements:
|
98
|
+
- - ! '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
132
101
|
requirements: []
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
signing_key:
|
102
|
+
rubyforge_project: !!null
|
103
|
+
rubygems_version: 1.5.0
|
104
|
+
signing_key: !!null
|
137
105
|
specification_version: 3
|
138
106
|
summary: attach an irb-like session to any object at runtime
|
139
107
|
test_files: []
|
140
|
-
|