pry 0.11.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +184 -1
  3. data/LICENSE +1 -1
  4. data/README.md +13 -30
  5. data/bin/pry +0 -4
  6. data/lib/pry/cli.rb +17 -24
  7. data/lib/pry/code/code_file.rb +5 -4
  8. data/lib/pry/code/code_range.rb +3 -3
  9. data/lib/pry/code/loc.rb +14 -8
  10. data/lib/pry/code.rb +6 -6
  11. data/lib/pry/code_object.rb +4 -4
  12. data/lib/pry/color_printer.rb +2 -1
  13. data/lib/pry/command.rb +36 -29
  14. data/lib/pry/command_set.rb +17 -52
  15. data/lib/pry/commands/amend_line.rb +3 -4
  16. data/lib/pry/commands/bang.rb +1 -1
  17. data/lib/pry/commands/cat/exception_formatter.rb +9 -8
  18. data/lib/pry/commands/cat/input_expression_formatter.rb +1 -1
  19. data/lib/pry/commands/cat.rb +7 -6
  20. data/lib/pry/commands/change_prompt.rb +29 -9
  21. data/lib/pry/commands/clear_screen.rb +14 -0
  22. data/lib/pry/commands/code_collector.rb +9 -9
  23. data/lib/pry/commands/easter_eggs.rb +3 -3
  24. data/lib/pry/commands/edit.rb +8 -7
  25. data/lib/pry/commands/exit.rb +2 -1
  26. data/lib/pry/commands/find_method.rb +11 -13
  27. data/lib/pry/commands/gem_cd.rb +1 -1
  28. data/lib/pry/commands/gem_install.rb +2 -2
  29. data/lib/pry/commands/gem_list.rb +2 -2
  30. data/lib/pry/commands/gem_open.rb +1 -1
  31. data/lib/pry/commands/gem_search.rb +2 -2
  32. data/lib/pry/commands/gem_stats.rb +83 -0
  33. data/lib/pry/commands/gist.rb +7 -6
  34. data/lib/pry/commands/help.rb +3 -3
  35. data/lib/pry/commands/hist.rb +9 -8
  36. data/lib/pry/commands/import_set.rb +2 -1
  37. data/lib/pry/commands/install_command.rb +7 -6
  38. data/lib/pry/commands/list_inspectors.rb +2 -2
  39. data/lib/pry/commands/ls/constants.rb +4 -4
  40. data/lib/pry/commands/ls/formatter.rb +3 -2
  41. data/lib/pry/commands/ls/globals.rb +0 -2
  42. data/lib/pry/commands/ls/grep.rb +0 -2
  43. data/lib/pry/commands/ls/instance_vars.rb +0 -1
  44. data/lib/pry/commands/ls/local_names.rb +0 -2
  45. data/lib/pry/commands/ls/local_vars.rb +0 -2
  46. data/lib/pry/commands/ls/ls_entity.rb +0 -1
  47. data/lib/pry/commands/ls/methods.rb +0 -3
  48. data/lib/pry/commands/ls/methods_helper.rb +1 -1
  49. data/lib/pry/commands/ls/self_methods.rb +0 -1
  50. data/lib/pry/commands/ls.rb +27 -30
  51. data/lib/pry/commands/play.rb +1 -2
  52. data/lib/pry/commands/pry_backtrace.rb +1 -1
  53. data/lib/pry/commands/raise_up.rb +2 -1
  54. data/lib/pry/commands/ri.rb +5 -4
  55. data/lib/pry/commands/shell_command.rb +3 -2
  56. data/lib/pry/commands/shell_mode.rb +6 -6
  57. data/lib/pry/commands/show_doc.rb +5 -7
  58. data/lib/pry/commands/show_info.rb +25 -18
  59. data/lib/pry/commands/show_source.rb +5 -2
  60. data/lib/pry/commands/stat.rb +1 -1
  61. data/lib/pry/commands/watch_expression.rb +9 -7
  62. data/lib/pry/commands/whereami.rb +5 -5
  63. data/lib/pry/commands/wtf.rb +15 -2
  64. data/lib/pry/config/behavior.rb +229 -204
  65. data/lib/pry/config/convenience.rb +24 -21
  66. data/lib/pry/config/default.rb +153 -143
  67. data/lib/pry/config/memoization.rb +41 -37
  68. data/lib/pry/config.rb +33 -9
  69. data/lib/pry/core_extensions.rb +4 -3
  70. data/lib/pry/editor.rb +5 -12
  71. data/lib/pry/exceptions.rb +0 -2
  72. data/lib/pry/helpers/base_helpers.rb +197 -106
  73. data/lib/pry/helpers/command_helpers.rb +5 -4
  74. data/lib/pry/helpers/documentation_helpers.rb +2 -2
  75. data/lib/pry/helpers/options_helpers.rb +5 -5
  76. data/lib/pry/helpers/platform.rb +58 -0
  77. data/lib/pry/helpers/table.rb +20 -15
  78. data/lib/pry/helpers/text.rb +23 -9
  79. data/lib/pry/helpers.rb +1 -0
  80. data/lib/pry/history.rb +21 -8
  81. data/lib/pry/hooks.rb +3 -3
  82. data/lib/pry/indent.rb +15 -17
  83. data/lib/pry/input_completer.rb +12 -7
  84. data/lib/pry/input_lock.rb +0 -2
  85. data/lib/pry/last_exception.rb +1 -1
  86. data/lib/pry/method/disowned.rb +2 -1
  87. data/lib/pry/method/patcher.rb +2 -2
  88. data/lib/pry/method/weird_method_locator.rb +21 -11
  89. data/lib/pry/method.rb +37 -31
  90. data/lib/pry/object_path.rb +5 -4
  91. data/lib/pry/output.rb +3 -2
  92. data/lib/pry/pager.rb +4 -3
  93. data/lib/pry/platform.rb +91 -0
  94. data/lib/pry/plugins.rb +7 -3
  95. data/lib/pry/prompt.rb +144 -25
  96. data/lib/pry/pry_class.rb +53 -29
  97. data/lib/pry/pry_instance.rb +88 -55
  98. data/lib/pry/repl.rb +33 -4
  99. data/lib/pry/repl_file_loader.rb +1 -2
  100. data/lib/pry/ring.rb +84 -0
  101. data/lib/pry/rubygem.rb +6 -6
  102. data/lib/pry/slop/commands.rb +3 -4
  103. data/lib/pry/slop/option.rb +19 -21
  104. data/lib/pry/slop.rb +17 -17
  105. data/lib/pry/terminal.rb +2 -1
  106. data/lib/pry/testable/evalable.rb +15 -0
  107. data/lib/pry/testable/mockable.rb +14 -0
  108. data/lib/pry/testable/pry_tester.rb +73 -0
  109. data/lib/pry/testable/utility.rb +26 -0
  110. data/lib/pry/testable/variables.rb +46 -0
  111. data/lib/pry/testable.rb +70 -0
  112. data/lib/pry/version.rb +1 -1
  113. data/lib/pry/wrapped_module/candidate.rb +2 -2
  114. data/lib/pry/wrapped_module.rb +15 -15
  115. data/lib/pry.rb +18 -47
  116. metadata +24 -30
  117. data/lib/pry/commands/list_prompts.rb +0 -35
  118. data/lib/pry/commands/simple_prompt.rb +0 -22
  119. data/lib/pry/history_array.rb +0 -121
  120. data/lib/pry/rbx_path.rb +0 -22
  121. data/lib/pry/test/helper.rb +0 -179
metadata CHANGED
@@ -1,64 +1,52 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mair (banisterfiend)
8
8
  - Conrad Irwin
9
9
  - Ryan Fitzgerald
10
- autorequire:
10
+ - Kyrylo Silin
11
+ autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2017-09-26 00:00:00.000000000 Z
14
+ date: 2018-11-04 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
- name: coderay
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
21
  version: 1.1.0
22
- type: :runtime
22
+ name: coderay
23
23
  prerelease: false
24
+ type: :runtime
24
25
  version_requirements: !ruby/object:Gem::Requirement
25
26
  requirements:
26
27
  - - "~>"
27
28
  - !ruby/object:Gem::Version
28
29
  version: 1.1.0
29
30
  - !ruby/object:Gem::Dependency
30
- name: method_source
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
35
  version: 0.9.0
36
- type: :runtime
36
+ name: method_source
37
37
  prerelease: false
38
+ type: :runtime
38
39
  version_requirements: !ruby/object:Gem::Requirement
39
40
  requirements:
40
41
  - - "~>"
41
42
  - !ruby/object:Gem::Version
42
43
  version: 0.9.0
43
- - !ruby/object:Gem::Dependency
44
- name: bundler
45
- requirement: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '1.0'
50
- type: :development
51
- prerelease: false
52
- version_requirements: !ruby/object:Gem::Requirement
53
- requirements:
54
- - - "~>"
55
- - !ruby/object:Gem::Version
56
- version: '1.0'
57
44
  description: An IRB alternative and runtime developer console
58
45
  email:
59
46
  - jrmair@gmail.com
60
47
  - conrad.irwin@gmail.com
61
48
  - rwfitzge@gmail.com
49
+ - silin@kyrylo.org
62
50
  executables:
63
51
  - pry
64
52
  extensions: []
@@ -91,6 +79,7 @@ files:
91
79
  - lib/pry/commands/cd.rb
92
80
  - lib/pry/commands/change_inspector.rb
93
81
  - lib/pry/commands/change_prompt.rb
82
+ - lib/pry/commands/clear_screen.rb
94
83
  - lib/pry/commands/code_collector.rb
95
84
  - lib/pry/commands/disable_pry.rb
96
85
  - lib/pry/commands/disabled_commands.rb
@@ -109,6 +98,7 @@ files:
109
98
  - lib/pry/commands/gem_open.rb
110
99
  - lib/pry/commands/gem_readme.rb
111
100
  - lib/pry/commands/gem_search.rb
101
+ - lib/pry/commands/gem_stats.rb
112
102
  - lib/pry/commands/gist.rb
113
103
  - lib/pry/commands/help.rb
114
104
  - lib/pry/commands/hist.rb
@@ -116,7 +106,6 @@ files:
116
106
  - lib/pry/commands/install_command.rb
117
107
  - lib/pry/commands/jump_to.rb
118
108
  - lib/pry/commands/list_inspectors.rb
119
- - lib/pry/commands/list_prompts.rb
120
109
  - lib/pry/commands/ls.rb
121
110
  - lib/pry/commands/ls/constants.rb
122
111
  - lib/pry/commands/ls/formatter.rb
@@ -146,7 +135,6 @@ files:
146
135
  - lib/pry/commands/show_info.rb
147
136
  - lib/pry/commands/show_input.rb
148
137
  - lib/pry/commands/show_source.rb
149
- - lib/pry/commands/simple_prompt.rb
150
138
  - lib/pry/commands/stat.rb
151
139
  - lib/pry/commands/switch_to.rb
152
140
  - lib/pry/commands/toggle_color.rb
@@ -168,10 +156,10 @@ files:
168
156
  - lib/pry/helpers/command_helpers.rb
169
157
  - lib/pry/helpers/documentation_helpers.rb
170
158
  - lib/pry/helpers/options_helpers.rb
159
+ - lib/pry/helpers/platform.rb
171
160
  - lib/pry/helpers/table.rb
172
161
  - lib/pry/helpers/text.rb
173
162
  - lib/pry/history.rb
174
- - lib/pry/history_array.rb
175
163
  - lib/pry/hooks.rb
176
164
  - lib/pry/indent.rb
177
165
  - lib/pry/input_completer.rb
@@ -185,20 +173,26 @@ files:
185
173
  - lib/pry/object_path.rb
186
174
  - lib/pry/output.rb
187
175
  - lib/pry/pager.rb
176
+ - lib/pry/platform.rb
188
177
  - lib/pry/plugins.rb
189
178
  - lib/pry/prompt.rb
190
179
  - lib/pry/pry_class.rb
191
180
  - lib/pry/pry_instance.rb
192
- - lib/pry/rbx_path.rb
193
181
  - lib/pry/repl.rb
194
182
  - lib/pry/repl_file_loader.rb
183
+ - lib/pry/ring.rb
195
184
  - lib/pry/rubygem.rb
196
185
  - lib/pry/slop.rb
197
186
  - lib/pry/slop/LICENSE
198
187
  - lib/pry/slop/commands.rb
199
188
  - lib/pry/slop/option.rb
200
189
  - lib/pry/terminal.rb
201
- - lib/pry/test/helper.rb
190
+ - lib/pry/testable.rb
191
+ - lib/pry/testable/evalable.rb
192
+ - lib/pry/testable/mockable.rb
193
+ - lib/pry/testable/pry_tester.rb
194
+ - lib/pry/testable/utility.rb
195
+ - lib/pry/testable/variables.rb
202
196
  - lib/pry/version.rb
203
197
  - lib/pry/wrapped_module.rb
204
198
  - lib/pry/wrapped_module/candidate.rb
@@ -206,7 +200,7 @@ homepage: http://pryrepl.org
206
200
  licenses:
207
201
  - MIT
208
202
  metadata: {}
209
- post_install_message:
203
+ post_install_message:
210
204
  rdoc_options: []
211
205
  require_paths:
212
206
  - lib
@@ -221,9 +215,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
215
  - !ruby/object:Gem::Version
222
216
  version: '0'
223
217
  requirements: []
224
- rubyforge_project:
225
- rubygems_version: 2.6.12
226
- signing_key:
218
+ rubyforge_project:
219
+ rubygems_version: 2.7.6
220
+ signing_key:
227
221
  specification_version: 4
228
222
  summary: An IRB alternative and runtime developer console
229
223
  test_files: []
@@ -1,35 +0,0 @@
1
- class Pry::Command::ListPrompts < Pry::ClassCommand
2
- match 'list-prompts'
3
- group 'Input and Output'
4
- description 'List the prompts available for use.'
5
- banner <<-BANNER
6
- Usage: list-prompts
7
-
8
- List the available prompts. You can use change-prompt to switch between
9
- them.
10
- BANNER
11
-
12
- def process
13
- output.puts heading("Available prompts") + "\n"
14
- prompt_map.each do |name, prompt|
15
- output.write "Name: #{text.bold(name)}"
16
- output.puts selected_prompt?(prompt) ? selected_text : ""
17
- output.puts prompt[:description]
18
- output.puts
19
- end
20
- end
21
-
22
- private
23
- def prompt_map
24
- Pry::Prompt::MAP
25
- end
26
-
27
- def selected_text
28
- text.red " (selected) "
29
- end
30
-
31
- def selected_prompt?(prompt)
32
- _pry_.prompt == prompt[:value]
33
- end
34
- Pry::Commands.add_command(self)
35
- end
@@ -1,22 +0,0 @@
1
- class Pry
2
- class Command::SimplePrompt < Pry::ClassCommand
3
- match 'simple-prompt'
4
- group 'prompts'
5
- description 'Toggle the simple prompt.'
6
-
7
- banner <<-'BANNER'
8
- Toggle the simple prompt.
9
- BANNER
10
-
11
- def process
12
- case _pry_.prompt
13
- when Pry::SIMPLE_PROMPT
14
- _pry_.pop_prompt
15
- else
16
- _pry_.push_prompt Pry::SIMPLE_PROMPT
17
- end
18
- end
19
- end
20
-
21
- Pry::Commands.add_command(Pry::Command::SimplePrompt)
22
- end
@@ -1,121 +0,0 @@
1
- class Pry
2
- # A history array is an array to which you can only add elements. Older
3
- # entries are removed progressively, so that the array never contains more than
4
- # N elements.
5
- #
6
- # History arrays are used by Pry to store the output of the last commands.
7
- #
8
- # @example
9
- # ary = Pry::HistoryArray.new 10
10
- # ary << 1 << 2 << 3
11
- # ary[0] # => 1
12
- # ary[1] # => 2
13
- # 10.times { |n| ary << n }
14
- # ary[0] # => nil
15
- # ary[-1] # => 9
16
- class HistoryArray
17
- include Enumerable
18
-
19
- # @param [Integer] size Maximum amount of objects in the array
20
- def initialize(size)
21
- @max_size = size
22
-
23
- @hash = {}
24
- @count = 0
25
- end
26
-
27
- # Pushes an object at the end of the array
28
- # @param [Object] value Object to be added
29
- def <<(value)
30
- @hash[@count] = value
31
-
32
- if @hash.size > max_size
33
- @hash.delete(@count - max_size)
34
- end
35
-
36
- @count += 1
37
-
38
- self
39
- end
40
-
41
- # @overload [](index)
42
- # @param [Integer] index Index of the item to access.
43
- # @return [Object, nil] Item at that index or nil if it has been removed.
44
- # @overload [](index, size)
45
- # @param [Integer] index Index of the first item to access.
46
- # @param [Integer] size Amount of items to access
47
- # @return [Array, nil] The selected items. Nil if index is greater than
48
- # the size of the array.
49
- # @overload [](range)
50
- # @param [Range<Integer>] range Range of indices to access.
51
- # @return [Array, nil] The selected items. Nil if index is greater than
52
- # the size of the array.
53
- def [](index_or_range, size = nil)
54
- if index_or_range.is_a? Integer
55
- index = convert_index(index_or_range)
56
-
57
- if size
58
- end_index = index + size
59
- index > @count ? nil : (index...[end_index, @count].min).map do |n|
60
- @hash[n]
61
- end
62
- else
63
- @hash[index]
64
- end
65
- else
66
- range = convert_range(index_or_range)
67
- range.begin > @count ? nil : range.map { |n| @hash[n] }
68
- end
69
- end
70
-
71
- # @return [Integer] Amount of objects in the array
72
- def size
73
- @count
74
- end
75
- alias count size
76
- alias length size
77
-
78
- def empty?
79
- size == 0
80
- end
81
-
82
- def each
83
- ((@count - size)...@count).each do |n|
84
- yield @hash[n]
85
- end
86
- end
87
-
88
- def to_a
89
- ((@count - size)...@count).map { |n| @hash[n] }
90
- end
91
-
92
- # @return [Hash] copy of the internal @hash history
93
- def to_h
94
- @hash.dup
95
- end
96
-
97
- def pop!
98
- @hash.delete @count - 1
99
- @count -= 1
100
- end
101
-
102
- def inspect
103
- "#<#{self.class} size=#{size} first=#{@count - size} max_size=#{max_size}>"
104
- end
105
-
106
- # @return [Integer] Maximum amount of objects in the array
107
- attr_reader :max_size
108
-
109
- private
110
- def convert_index(n)
111
- n >= 0 ? n : @count + n
112
- end
113
-
114
- def convert_range(range)
115
- end_index = convert_index(range.end)
116
- end_index += 1 unless range.exclude_end?
117
-
118
- Range.new(convert_index(range.begin), [end_index, @count].min, true)
119
- end
120
- end
121
- end
data/lib/pry/rbx_path.rb DELETED
@@ -1,22 +0,0 @@
1
- class Pry
2
- module RbxPath
3
- module_function
4
- def is_core_path?(path)
5
- Pry::Helpers::BaseHelpers.rbx? && (path.start_with?("kernel") || path.start_with?("lib")) && File.exist?(convert_path_to_full(path))
6
- end
7
-
8
- def convert_path_to_full(path)
9
- if path.start_with?("kernel")
10
- File.join File.dirname(Rubinius::KERNEL_PATH), path
11
- elsif path.start_with?("lib")
12
- File.join File.dirname(Rubinius::LIB_PATH), path
13
- else
14
- path
15
- end
16
- end
17
-
18
- def rvm_ruby?(path)
19
- !!(path =~ /\.rvm/)
20
- end
21
- end
22
- end
@@ -1,179 +0,0 @@
1
- require 'pry'
2
-
3
- # in case the tests call reset_defaults, ensure we reset them to
4
- # amended (test friendly) values
5
- class << Pry
6
- alias_method :orig_reset_defaults, :reset_defaults
7
- def reset_defaults
8
- orig_reset_defaults
9
-
10
- Pry.config.color = false
11
- Pry.config.pager = false
12
- Pry.config.should_load_rc = false
13
- Pry.config.should_load_local_rc= false
14
- Pry.config.should_load_plugins = false
15
- Pry.config.history.should_load = false
16
- Pry.config.history.should_save = false
17
- Pry.config.correct_indent = false
18
- Pry.config.hooks = Pry::Hooks.new
19
- Pry.config.collision_warning = false
20
- end
21
- end
22
- Pry.reset_defaults
23
-
24
- # A global space for storing temporary state during tests.
25
-
26
- module PryTestHelpers
27
-
28
- module_function
29
-
30
- # inject a variable into a binding
31
- def inject_var(name, value, b)
32
- Pry.current[:pry_local] = value
33
- b.eval("#{name} = ::Pry.current[:pry_local]")
34
- ensure
35
- Pry.current[:pry_local] = nil
36
- end
37
-
38
- def constant_scope(*names)
39
- names.each do |name|
40
- Object.remove_const name if Object.const_defined?(name)
41
- end
42
-
43
- yield
44
- ensure
45
- names.each do |name|
46
- Object.remove_const name if Object.const_defined?(name)
47
- end
48
- end
49
-
50
- # Open a temp file and yield it to the block, closing it after
51
- # @return [String] The path of the temp file
52
- def temp_file(ext='.rb')
53
- file = Tempfile.new(['pry', ext])
54
- yield file
55
- ensure
56
- file.close(true) if file
57
- File.unlink("#{file.path}c") if File.exist?("#{file.path}c") # rbx
58
- end
59
-
60
- def unindent(*args)
61
- Pry::Helpers::CommandHelpers.unindent(*args)
62
- end
63
-
64
- def mock_command(cmd, args=[], opts={})
65
- output = StringIO.new
66
- pry = Pry.new(output: output)
67
- ret = cmd.new(opts.merge(pry_instance: pry, :output => output)).call_safely(*args)
68
- Struct.new(:output, :return).new(output.string, ret)
69
- end
70
-
71
- def mock_exception(*mock_backtrace)
72
- StandardError.new.tap do |e|
73
- e.define_singleton_method(:backtrace) { mock_backtrace }
74
- end
75
- end
76
-
77
- def inner_scope
78
- catch(:inner_scope) do
79
- yield ->{ throw(:inner_scope, self) }
80
- end
81
- end
82
- end
83
-
84
- def pry_tester(*args, &block)
85
- if args.length == 0 || args[0].is_a?(Hash)
86
- args.unshift(Pry.toplevel_binding)
87
- end
88
-
89
- PryTester.new(*args).tap do |t|
90
- (class << t; self; end).class_eval(&block) if block
91
- end
92
- end
93
-
94
- def pry_eval(*eval_strs)
95
- if eval_strs.first.is_a? String
96
- binding = Pry.toplevel_binding
97
- else
98
- binding = Pry.binding_for(eval_strs.shift)
99
- end
100
-
101
- pry_tester(binding).eval(*eval_strs)
102
- end
103
-
104
- class PryTester
105
- extend Pry::Forwardable
106
-
107
- attr_reader :pry, :out
108
-
109
- def_delegators :@pry, :eval_string, :eval_string=
110
-
111
- def initialize(target = TOPLEVEL_BINDING, options = {})
112
- @pry = Pry.new(options.merge(:target => target))
113
- @history = options[:history]
114
-
115
- @pry.inject_sticky_locals!
116
- reset_output
117
- end
118
-
119
- def eval(*strs)
120
- reset_output
121
- result = nil
122
-
123
- strs.flatten.each do |str|
124
- # Check for space prefix. See #1369.
125
- if str !~ /^\s\S/
126
- str = "#{str.strip}\n"
127
- end
128
- @history.push str if @history
129
-
130
- if @pry.process_command(str)
131
- result = last_command_result_or_output
132
- else
133
- result = @pry.evaluate_ruby(str)
134
- end
135
- end
136
-
137
- result
138
- end
139
-
140
- def push(*lines)
141
- Array(lines).flatten.each do |line|
142
- @pry.eval(line)
143
- end
144
- end
145
-
146
- def push_binding(context)
147
- @pry.push_binding context
148
- end
149
-
150
- def last_output
151
- @out.string if @out
152
- end
153
-
154
- def process_command(command_str)
155
- @pry.process_command(command_str) or raise "Not a valid command"
156
- last_command_result_or_output
157
- end
158
-
159
- def last_command_result
160
- result = Pry.current[:pry_cmd_result]
161
- result.retval if result
162
- end
163
-
164
- protected
165
-
166
- def last_command_result_or_output
167
- result = last_command_result
168
- if result != Pry::Command::VOID_VALUE
169
- result
170
- else
171
- last_output
172
- end
173
- end
174
-
175
- def reset_output
176
- @out = StringIO.new
177
- @pry.output = @out
178
- end
179
- end