pry 0.10.pre.1-i386-mingw32 → 0.10.0.pre3-i386-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +702 -0
- data/LICENSE +2 -2
- data/{README.markdown → README.md} +41 -35
- data/lib/pry.rb +82 -139
- data/lib/pry/cli.rb +77 -30
- data/lib/pry/code.rb +122 -183
- data/lib/pry/code/code_file.rb +103 -0
- data/lib/pry/code/code_range.rb +71 -0
- data/lib/pry/code/loc.rb +92 -0
- data/lib/pry/code_object.rb +172 -0
- data/lib/pry/color_printer.rb +55 -0
- data/lib/pry/command.rb +184 -28
- data/lib/pry/command_set.rb +113 -59
- data/lib/pry/commands.rb +4 -27
- data/lib/pry/commands/amend_line.rb +99 -0
- data/lib/pry/commands/bang.rb +20 -0
- data/lib/pry/commands/bang_pry.rb +17 -0
- data/lib/pry/commands/cat.rb +62 -0
- data/lib/pry/commands/cat/abstract_formatter.rb +27 -0
- data/lib/pry/commands/cat/exception_formatter.rb +77 -0
- data/lib/pry/commands/cat/file_formatter.rb +67 -0
- data/lib/pry/commands/cat/input_expression_formatter.rb +43 -0
- data/lib/pry/commands/cd.rb +41 -0
- data/lib/pry/commands/change_inspector.rb +27 -0
- data/lib/pry/commands/change_prompt.rb +26 -0
- data/lib/pry/commands/code_collector.rb +165 -0
- data/lib/pry/commands/disable_pry.rb +27 -0
- data/lib/pry/commands/disabled_commands.rb +2 -0
- data/lib/pry/commands/easter_eggs.rb +112 -0
- data/lib/pry/commands/edit.rb +195 -0
- data/lib/pry/commands/edit/exception_patcher.rb +25 -0
- data/lib/pry/commands/edit/file_and_line_locator.rb +36 -0
- data/lib/pry/commands/exit.rb +42 -0
- data/lib/pry/commands/exit_all.rb +29 -0
- data/lib/pry/commands/exit_program.rb +23 -0
- data/lib/pry/commands/find_method.rb +193 -0
- data/lib/pry/commands/fix_indent.rb +19 -0
- data/lib/pry/commands/gem_cd.rb +26 -0
- data/lib/pry/commands/gem_install.rb +32 -0
- data/lib/pry/commands/gem_list.rb +33 -0
- data/lib/pry/commands/gem_open.rb +29 -0
- data/lib/pry/commands/gist.rb +101 -0
- data/lib/pry/commands/help.rb +164 -0
- data/lib/pry/commands/hist.rb +180 -0
- data/lib/pry/commands/import_set.rb +22 -0
- data/lib/pry/commands/install_command.rb +53 -0
- data/lib/pry/commands/jump_to.rb +29 -0
- data/lib/pry/commands/list_inspectors.rb +35 -0
- data/lib/pry/commands/list_prompts.rb +35 -0
- data/lib/pry/commands/ls.rb +114 -0
- data/lib/pry/commands/ls/constants.rb +47 -0
- data/lib/pry/commands/ls/formatter.rb +49 -0
- data/lib/pry/commands/ls/globals.rb +48 -0
- data/lib/pry/commands/ls/grep.rb +21 -0
- data/lib/pry/commands/ls/instance_vars.rb +39 -0
- data/lib/pry/commands/ls/interrogatable.rb +18 -0
- data/lib/pry/commands/ls/jruby_hacks.rb +49 -0
- data/lib/pry/commands/ls/local_names.rb +35 -0
- data/lib/pry/commands/ls/local_vars.rb +39 -0
- data/lib/pry/commands/ls/ls_entity.rb +70 -0
- data/lib/pry/commands/ls/methods.rb +57 -0
- data/lib/pry/commands/ls/methods_helper.rb +46 -0
- data/lib/pry/commands/ls/self_methods.rb +32 -0
- data/lib/pry/commands/nesting.rb +25 -0
- data/lib/pry/commands/play.rb +103 -0
- data/lib/pry/commands/pry_backtrace.rb +25 -0
- data/lib/pry/commands/pry_version.rb +17 -0
- data/lib/pry/commands/raise_up.rb +32 -0
- data/lib/pry/commands/reload_code.rb +62 -0
- data/lib/pry/commands/reset.rb +18 -0
- data/lib/pry/commands/ri.rb +60 -0
- data/lib/pry/commands/save_file.rb +61 -0
- data/lib/pry/commands/shell_command.rb +48 -0
- data/lib/pry/commands/shell_mode.rb +25 -0
- data/lib/pry/commands/show_doc.rb +83 -0
- data/lib/pry/commands/show_info.rb +195 -0
- data/lib/pry/commands/show_input.rb +17 -0
- data/lib/pry/commands/show_source.rb +50 -0
- data/lib/pry/commands/simple_prompt.rb +22 -0
- data/lib/pry/commands/stat.rb +40 -0
- data/lib/pry/commands/switch_to.rb +23 -0
- data/lib/pry/commands/toggle_color.rb +24 -0
- data/lib/pry/commands/watch_expression.rb +105 -0
- data/lib/pry/commands/watch_expression/expression.rb +38 -0
- data/lib/pry/commands/whereami.rb +190 -0
- data/lib/pry/commands/wtf.rb +57 -0
- data/lib/pry/config.rb +20 -229
- data/lib/pry/config/behavior.rb +139 -0
- data/lib/pry/config/convenience.rb +26 -0
- data/lib/pry/config/default.rb +165 -0
- data/lib/pry/core_extensions.rb +59 -38
- data/lib/pry/editor.rb +133 -0
- data/lib/pry/exceptions.rb +77 -0
- data/lib/pry/helpers.rb +1 -0
- data/lib/pry/helpers/base_helpers.rb +40 -154
- data/lib/pry/helpers/command_helpers.rb +19 -130
- data/lib/pry/helpers/documentation_helpers.rb +21 -11
- data/lib/pry/helpers/table.rb +109 -0
- data/lib/pry/helpers/text.rb +8 -9
- data/lib/pry/history.rb +61 -45
- data/lib/pry/history_array.rb +11 -1
- data/lib/pry/hooks.rb +10 -32
- data/lib/pry/indent.rb +110 -38
- data/lib/pry/input_completer.rb +242 -0
- data/lib/pry/input_lock.rb +132 -0
- data/lib/pry/inspector.rb +27 -0
- data/lib/pry/last_exception.rb +61 -0
- data/lib/pry/method.rb +199 -200
- data/lib/pry/method/disowned.rb +53 -0
- data/lib/pry/method/patcher.rb +125 -0
- data/lib/pry/method/weird_method_locator.rb +186 -0
- data/lib/pry/module_candidate.rb +39 -33
- data/lib/pry/object_path.rb +82 -0
- data/lib/pry/output.rb +50 -0
- data/lib/pry/pager.rb +234 -0
- data/lib/pry/plugins.rb +4 -3
- data/lib/pry/prompt.rb +26 -0
- data/lib/pry/pry_class.rb +199 -227
- data/lib/pry/pry_instance.rb +344 -403
- data/lib/pry/rbx_path.rb +1 -1
- data/lib/pry/repl.rb +202 -0
- data/lib/pry/repl_file_loader.rb +20 -26
- data/lib/pry/rubygem.rb +82 -0
- data/lib/pry/terminal.rb +79 -0
- data/lib/pry/test/helper.rb +170 -0
- data/lib/pry/version.rb +1 -1
- data/lib/pry/wrapped_module.rb +133 -48
- metadata +132 -197
- data/.document +0 -2
- data/.gemtest +0 -0
- data/.gitignore +0 -16
- data/.travis.yml +0 -17
- data/.yardopts +0 -1
- data/CHANGELOG +0 -387
- data/CONTRIBUTORS +0 -36
- data/Gemfile +0 -2
- data/Rakefile +0 -137
- data/TODO +0 -117
- data/examples/example_basic.rb +0 -15
- data/examples/example_command_override.rb +0 -32
- data/examples/example_commands.rb +0 -36
- data/examples/example_hooks.rb +0 -9
- data/examples/example_image_edit.rb +0 -67
- data/examples/example_input.rb +0 -7
- data/examples/example_input2.rb +0 -29
- data/examples/example_output.rb +0 -11
- data/examples/example_print.rb +0 -6
- data/examples/example_prompt.rb +0 -9
- data/examples/helper.rb +0 -6
- data/lib/pry/completion.rb +0 -221
- data/lib/pry/custom_completions.rb +0 -6
- data/lib/pry/default_commands/cd.rb +0 -81
- data/lib/pry/default_commands/commands.rb +0 -62
- data/lib/pry/default_commands/context.rb +0 -98
- data/lib/pry/default_commands/easter_eggs.rb +0 -95
- data/lib/pry/default_commands/editing.rb +0 -420
- data/lib/pry/default_commands/find_method.rb +0 -169
- data/lib/pry/default_commands/gems.rb +0 -84
- data/lib/pry/default_commands/gist.rb +0 -187
- data/lib/pry/default_commands/help.rb +0 -127
- data/lib/pry/default_commands/hist.rb +0 -120
- data/lib/pry/default_commands/input_and_output.rb +0 -306
- data/lib/pry/default_commands/introspection.rb +0 -410
- data/lib/pry/default_commands/ls.rb +0 -272
- data/lib/pry/default_commands/misc.rb +0 -38
- data/lib/pry/default_commands/navigating_pry.rb +0 -110
- data/lib/pry/default_commands/whereami.rb +0 -92
- data/lib/pry/extended_commands/experimental.rb +0 -7
- data/lib/pry/rbx_method.rb +0 -13
- data/man/pry.1 +0 -195
- data/man/pry.1.html +0 -204
- data/man/pry.1.ronn +0 -141
- data/pry.gemspec +0 -46
- data/test/candidate_helper1.rb +0 -11
- data/test/candidate_helper2.rb +0 -8
- data/test/helper.rb +0 -223
- data/test/test_cli.rb +0 -78
- data/test/test_code.rb +0 -201
- data/test/test_command.rb +0 -712
- data/test/test_command_helpers.rb +0 -9
- data/test/test_command_integration.rb +0 -668
- data/test/test_command_set.rb +0 -610
- data/test/test_completion.rb +0 -62
- data/test/test_control_d_handler.rb +0 -45
- data/test/test_default_commands/example.erb +0 -5
- data/test/test_default_commands/test_cd.rb +0 -318
- data/test/test_default_commands/test_context.rb +0 -280
- data/test/test_default_commands/test_documentation.rb +0 -314
- data/test/test_default_commands/test_find_method.rb +0 -50
- data/test/test_default_commands/test_gems.rb +0 -18
- data/test/test_default_commands/test_help.rb +0 -57
- data/test/test_default_commands/test_input.rb +0 -428
- data/test/test_default_commands/test_introspection.rb +0 -511
- data/test/test_default_commands/test_ls.rb +0 -151
- data/test/test_default_commands/test_shell.rb +0 -343
- data/test/test_default_commands/test_show_source.rb +0 -432
- data/test/test_exception_whitelist.rb +0 -21
- data/test/test_history_array.rb +0 -65
- data/test/test_hooks.rb +0 -521
- data/test/test_indent.rb +0 -277
- data/test/test_input_stack.rb +0 -86
- data/test/test_method.rb +0 -401
- data/test/test_pry.rb +0 -463
- data/test/test_pry_defaults.rb +0 -419
- data/test/test_pry_history.rb +0 -84
- data/test/test_pry_output.rb +0 -41
- data/test/test_sticky_locals.rb +0 -155
- data/test/test_syntax_checking.rb +0 -65
- data/test/test_wrapped_module.rb +0 -174
- data/test/testrc +0 -2
- data/test/testrcbad +0 -2
- data/wiki/Customizing-pry.md +0 -397
- data/wiki/Home.md +0 -4
data/lib/pry/pry_instance.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# -*- coding: utf-8 -*-
|
3
2
|
##
|
4
3
|
# Pry is a powerful alternative to the standard IRB shell for Ruby. It
|
5
4
|
# features syntax highlighting, a flexible plugin architecture, runtime
|
@@ -21,100 +20,65 @@ require "pry/indent"
|
|
21
20
|
# * https://github.com/pry/pry
|
22
21
|
# * the IRC channel, which is #pry on the Freenode network
|
23
22
|
#
|
24
|
-
class Pry
|
25
|
-
|
26
|
-
attr_accessor :input
|
27
|
-
attr_accessor :output
|
28
|
-
attr_accessor :commands
|
29
|
-
attr_accessor :print
|
30
|
-
attr_accessor :exception_handler
|
31
|
-
attr_accessor :input_stack
|
32
|
-
attr_accessor :quiet
|
33
|
-
alias :quiet? :quiet
|
34
|
-
|
35
|
-
attr_accessor :custom_completions
|
36
23
|
|
24
|
+
class Pry
|
37
25
|
attr_accessor :binding_stack
|
38
|
-
|
26
|
+
attr_accessor :custom_completions
|
27
|
+
attr_accessor :eval_string
|
28
|
+
attr_accessor :backtrace
|
29
|
+
attr_accessor :suppress_output
|
39
30
|
attr_accessor :last_result
|
40
31
|
attr_accessor :last_file
|
41
32
|
attr_accessor :last_dir
|
42
33
|
|
43
34
|
attr_reader :last_exception
|
44
|
-
|
35
|
+
attr_reader :command_state
|
36
|
+
attr_reader :exit_value
|
45
37
|
attr_reader :input_array
|
46
38
|
attr_reader :output_array
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
#
|
55
|
-
|
56
|
-
|
57
|
-
#
|
58
|
-
#
|
59
|
-
|
60
|
-
|
61
|
-
#
|
62
|
-
#
|
63
|
-
# @
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
# Create a new `Pry` object.
|
74
|
-
# @param [Hash] options The optional configuration parameters.
|
75
|
-
# @option options [#readline] :input The object to use for input.
|
76
|
-
# @option options [#puts] :output The object to use for output.
|
77
|
-
# @option options [Pry::CommandBase] :commands The object to use for commands.
|
78
|
-
# @option options [Hash] :hooks The defined hook Procs
|
79
|
-
# @option options [Array<Proc>] :prompt The array of Procs to use for the prompts.
|
80
|
-
# @option options [Proc] :print The Proc to use for the 'print'
|
81
|
-
# @option options [Boolean] :quiet If true, omit the whereami banner when starting.
|
82
|
-
# component of the REPL. (see print.rb)
|
39
|
+
attr_reader :config
|
40
|
+
|
41
|
+
extend Pry::Config::Convenience
|
42
|
+
config_shortcut *Pry::Config.shortcuts
|
43
|
+
EMPTY_COMPLETIONS = [].freeze
|
44
|
+
|
45
|
+
# Create a new {Pry} instance.
|
46
|
+
# @param [Hash] options
|
47
|
+
# @option options [#readline] :input
|
48
|
+
# The object to use for input.
|
49
|
+
# @option options [#puts] :output
|
50
|
+
# The object to use for output.
|
51
|
+
# @option options [Pry::CommandBase] :commands
|
52
|
+
# The object to use for commands.
|
53
|
+
# @option options [Hash] :hooks
|
54
|
+
# The defined hook Procs.
|
55
|
+
# @option options [Array<Proc>] :prompt
|
56
|
+
# The array of Procs to use for prompts.
|
57
|
+
# @option options [Proc] :print
|
58
|
+
# The Proc to use for printing return values.
|
59
|
+
# @option options [Boolean] :quiet
|
60
|
+
# Omit the `whereami` banner when starting.
|
61
|
+
# @option options [Array<String>] :backtrace
|
62
|
+
# The backtrace of the session's `binding.pry` line, if applicable.
|
63
|
+
# @option options [Object] :target
|
64
|
+
# The initial context for this session.
|
83
65
|
def initialize(options={})
|
84
|
-
refresh(options)
|
85
|
-
|
86
66
|
@binding_stack = []
|
87
67
|
@indent = Pry::Indent.new
|
88
68
|
@command_state = {}
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
attributes.each do |attribute|
|
104
|
-
defaults[attribute] = Pry.send attribute
|
105
|
-
end
|
106
|
-
|
107
|
-
defaults.merge!(options).each do |key, value|
|
108
|
-
send("#{key}=", value) if respond_to?("#{key}=")
|
109
|
-
end
|
110
|
-
|
111
|
-
true
|
112
|
-
end
|
113
|
-
|
114
|
-
# The currently active `Binding`.
|
115
|
-
# @return [Binding] The currently active `Binding` for the session.
|
116
|
-
def current_context
|
117
|
-
binding_stack.last
|
69
|
+
@eval_string = ""
|
70
|
+
@backtrace = options.delete(:backtrace) || caller
|
71
|
+
target = options.delete(:target)
|
72
|
+
@config = Pry::Config.new
|
73
|
+
config.merge!(options)
|
74
|
+
push_prompt(config.prompt)
|
75
|
+
@input_array = Pry::HistoryArray.new config.memory_size
|
76
|
+
@output_array = Pry::HistoryArray.new config.memory_size
|
77
|
+
@custom_completions = config.command_completions
|
78
|
+
set_last_result nil
|
79
|
+
@input_array << nil
|
80
|
+
push_initial_binding(target)
|
81
|
+
exec_hook(:when_started, target, options, self)
|
118
82
|
end
|
119
83
|
|
120
84
|
# The current prompt.
|
@@ -137,16 +101,70 @@ class Pry
|
|
137
101
|
end
|
138
102
|
end
|
139
103
|
|
104
|
+
# Initialize this instance by pushing its initial context into the binding
|
105
|
+
# stack. If no target is given, start at the top level.
|
106
|
+
def push_initial_binding(target=nil)
|
107
|
+
push_binding(target || Pry.toplevel_binding)
|
108
|
+
end
|
109
|
+
|
110
|
+
# The currently active `Binding`.
|
111
|
+
# @return [Binding] The currently active `Binding` for the session.
|
112
|
+
def current_binding
|
113
|
+
binding_stack.last
|
114
|
+
end
|
115
|
+
alias current_context current_binding # support previous API
|
116
|
+
|
117
|
+
# Push a binding for the given object onto the stack. If this instance is
|
118
|
+
# currently stopped, mark it as usable again.
|
119
|
+
def push_binding(object)
|
120
|
+
@stopped = false
|
121
|
+
binding_stack << Pry.binding_for(object)
|
122
|
+
end
|
123
|
+
|
124
|
+
#
|
125
|
+
# Generate completions.
|
126
|
+
#
|
127
|
+
# @param [String] input
|
128
|
+
# What the user has typed so far
|
129
|
+
#
|
130
|
+
# @return [Array<String>]
|
131
|
+
# Possible completions
|
132
|
+
#
|
133
|
+
def complete(str)
|
134
|
+
return EMPTY_COMPLETIONS unless config.completer
|
135
|
+
Pry.critical_section do
|
136
|
+
completer = config.completer.new(config.input, self)
|
137
|
+
completer.call str, target: current_binding, custom_completions: custom_completions.call.push(*sticky_locals.keys)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
#
|
140
142
|
# Injects a local variable into the provided binding.
|
141
|
-
#
|
142
|
-
# @param [
|
143
|
-
#
|
144
|
-
#
|
143
|
+
#
|
144
|
+
# @param [String] name
|
145
|
+
# The name of the local to inject.
|
146
|
+
#
|
147
|
+
# @param [Object] value
|
148
|
+
# The value to set the local to.
|
149
|
+
#
|
150
|
+
# @param [Binding] b
|
151
|
+
# The binding to set the local on.
|
152
|
+
#
|
153
|
+
# @return [Object]
|
154
|
+
# The value the local was set to.
|
155
|
+
#
|
145
156
|
def inject_local(name, value, b)
|
146
|
-
|
147
|
-
b.
|
148
|
-
|
149
|
-
|
157
|
+
value = Proc === value ? value.call : value
|
158
|
+
if b.respond_to?(:local_variable_set)
|
159
|
+
b.local_variable_set name, value
|
160
|
+
else # < 2.1
|
161
|
+
begin
|
162
|
+
Pry.current[:pry_local] = value
|
163
|
+
b.eval "#{name} = ::Pry.current[:pry_local]"
|
164
|
+
ensure
|
165
|
+
Pry.current[:pry_local] = nil
|
166
|
+
end
|
167
|
+
end
|
150
168
|
end
|
151
169
|
|
152
170
|
# @return [Integer] The maximum amount of objects remembered by the inp and
|
@@ -160,11 +178,10 @@ class Pry
|
|
160
178
|
@output_array = Pry::HistoryArray.new(size)
|
161
179
|
end
|
162
180
|
|
163
|
-
# Inject all the sticky locals into the
|
164
|
-
|
165
|
-
def inject_sticky_locals(target)
|
181
|
+
# Inject all the sticky locals into the current binding.
|
182
|
+
def inject_sticky_locals!
|
166
183
|
sticky_locals.each_pair do |name, value|
|
167
|
-
inject_local(name, value,
|
184
|
+
inject_local(name, value, current_binding)
|
168
185
|
end
|
169
186
|
end
|
170
187
|
|
@@ -174,158 +191,180 @@ class Pry
|
|
174
191
|
# @yield The block that defines the content of the local. The local
|
175
192
|
# will be refreshed at each tick of the repl loop.
|
176
193
|
def add_sticky_local(name, &block)
|
177
|
-
|
194
|
+
config.extra_sticky_locals[name] = block
|
178
195
|
end
|
179
196
|
|
180
|
-
# @return [Hash] The currently defined sticky locals.
|
181
197
|
def sticky_locals
|
182
|
-
|
183
|
-
:
|
184
|
-
:
|
185
|
-
:
|
186
|
-
:
|
187
|
-
:
|
188
|
-
:
|
189
|
-
:
|
190
|
-
}.merge(extra_sticky_locals)
|
191
|
-
end
|
192
|
-
|
193
|
-
# Initialize the repl session.
|
194
|
-
# @param [Binding] target The target binding for the session.
|
195
|
-
def repl_prologue(target)
|
196
|
-
exec_hook :before_session, output, target, self
|
197
|
-
set_last_result(nil, target)
|
198
|
-
|
199
|
-
|
200
|
-
@input_array << nil # add empty input so _in_ and _out_ match
|
201
|
-
|
202
|
-
binding_stack.push target
|
198
|
+
{ _in_: input_array,
|
199
|
+
_out_: output_array,
|
200
|
+
_pry_: self,
|
201
|
+
_ex_: last_exception && last_exception.wrapped_exception,
|
202
|
+
_file_: last_file,
|
203
|
+
_dir_: last_dir,
|
204
|
+
_: proc { last_result },
|
205
|
+
__: proc { output_array[-2] }
|
206
|
+
}.merge(config.extra_sticky_locals)
|
203
207
|
end
|
204
208
|
|
205
|
-
#
|
206
|
-
#
|
207
|
-
def
|
208
|
-
|
209
|
-
|
210
|
-
binding_stack.pop
|
211
|
-
Pry.save_history if Pry.config.history.should_save
|
209
|
+
# Reset the current eval string. If the user has entered part of a multiline
|
210
|
+
# expression, this discards that input.
|
211
|
+
def reset_eval_string
|
212
|
+
@eval_string = ""
|
212
213
|
end
|
213
214
|
|
214
|
-
#
|
215
|
-
#
|
216
|
-
#
|
217
|
-
#
|
218
|
-
#
|
219
|
-
#
|
220
|
-
#
|
221
|
-
#
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
215
|
+
# Pass a line of input to Pry.
|
216
|
+
#
|
217
|
+
# This is the equivalent of `Binding#eval` but with extra Pry!
|
218
|
+
#
|
219
|
+
# In particular:
|
220
|
+
# 1. Pry commands will be executed immediately if the line matches.
|
221
|
+
# 2. Partial lines of input will be queued up until a complete expression has
|
222
|
+
# been accepted.
|
223
|
+
# 3. Output is written to `#output` in pretty colours, not returned.
|
224
|
+
#
|
225
|
+
# Once this method has raised an exception or returned false, this instance
|
226
|
+
# is no longer usable. {#exit_value} will return the session's breakout
|
227
|
+
# value if applicable.
|
228
|
+
#
|
229
|
+
# @param [String?] line The line of input; `nil` if the user types `<Ctrl-D>`
|
230
|
+
# @option options [Boolean] :generated Whether this line was generated automatically.
|
231
|
+
# Generated lines are not stored in history.
|
232
|
+
# @return [Boolean] Is Pry ready to accept more input?
|
233
|
+
# @raise [Exception] If the user uses the `raise-up` command, this method
|
234
|
+
# will raise that exception.
|
235
|
+
def eval(line, options={})
|
236
|
+
return false if @stopped
|
237
|
+
|
238
|
+
exit_value = nil
|
228
239
|
exception = catch(:raise_up) do
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
240
|
+
exit_value = catch(:breakout) do
|
241
|
+
handle_line(line, options)
|
242
|
+
# We use 'return !@stopped' here instead of 'return true' so that if
|
243
|
+
# handle_line has stopped this pry instance (e.g. by opening _pry_.repl and
|
244
|
+
# then popping all the bindings) we still exit immediately.
|
245
|
+
return !@stopped
|
233
246
|
end
|
234
247
|
exception = false
|
235
248
|
end
|
236
249
|
|
237
|
-
|
250
|
+
@stopped = true
|
251
|
+
@exit_value = exit_value
|
238
252
|
|
239
|
-
|
240
|
-
|
241
|
-
|
253
|
+
# TODO: make this configurable?
|
254
|
+
raise exception if exception
|
255
|
+
return false
|
242
256
|
end
|
243
257
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
def rep(target=TOPLEVEL_BINDING)
|
250
|
-
target = Pry.binding_for(target)
|
251
|
-
result = re(target)
|
252
|
-
|
253
|
-
show_result(result) if should_print?
|
254
|
-
end
|
258
|
+
def handle_line(line, options)
|
259
|
+
if line.nil?
|
260
|
+
config.control_d_handler.call(@eval_string, self)
|
261
|
+
return
|
262
|
+
end
|
255
263
|
|
256
|
-
|
257
|
-
|
258
|
-
# @param [Object, Binding] target The receiver of the read-eval-print
|
259
|
-
# @return [Object] The result of the eval or an `Exception` object in case of
|
260
|
-
# error. In the latter case, you can check whether the exception was raised
|
261
|
-
# or is just the result of the expression using #last_result_is_exception?
|
262
|
-
# @example
|
263
|
-
# Pry.new.re(Object.new)
|
264
|
-
def re(target=TOPLEVEL_BINDING)
|
265
|
-
target = Pry.binding_for(target)
|
264
|
+
ensure_correct_encoding!(line)
|
265
|
+
Pry.history << line unless options[:generated]
|
266
266
|
|
267
|
-
|
268
|
-
|
269
|
-
|
267
|
+
@suppress_output = false
|
268
|
+
inject_sticky_locals!
|
269
|
+
begin
|
270
|
+
if !process_command_safely(line.lstrip)
|
271
|
+
@eval_string << "#{line.chomp}\n" if !line.empty? || !@eval_string.empty?
|
272
|
+
end
|
273
|
+
rescue RescuableException => e
|
274
|
+
self.last_exception = e
|
275
|
+
result = e
|
270
276
|
|
271
|
-
|
277
|
+
Pry.critical_section do
|
278
|
+
show_result(result)
|
279
|
+
end
|
280
|
+
return
|
281
|
+
end
|
272
282
|
|
273
|
-
|
283
|
+
# This hook is supposed to be executed after each line of ruby code
|
284
|
+
# has been read (regardless of whether eval_string is yet a complete expression)
|
285
|
+
exec_hook :after_read, eval_string, self
|
274
286
|
|
275
|
-
|
276
|
-
|
287
|
+
begin
|
288
|
+
complete_expr = Pry::Code.complete_expression?(@eval_string)
|
289
|
+
rescue SyntaxError => e
|
290
|
+
output.puts "SyntaxError: #{e.message.sub(/.*syntax error, */m, '')}"
|
291
|
+
reset_eval_string
|
292
|
+
end
|
277
293
|
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
ensure
|
283
|
-
update_input_history(code)
|
284
|
-
exec_hook :after_eval, result, self
|
285
|
-
end
|
294
|
+
if complete_expr
|
295
|
+
if @eval_string =~ /;\Z/ || @eval_string.empty? || @eval_string =~ /\A *#.*\n\z/
|
296
|
+
@suppress_output = true
|
297
|
+
end
|
286
298
|
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
299
|
+
# A bug in jruby makes java.lang.Exception not rescued by
|
300
|
+
# `rescue Pry::RescuableException` clause.
|
301
|
+
#
|
302
|
+
# * https://github.com/pry/pry/issues/854
|
303
|
+
# * https://jira.codehaus.org/browse/JRUBY-7100
|
304
|
+
#
|
305
|
+
# Until that gets fixed upstream, treat java.lang.Exception
|
306
|
+
# as an additional exception to be rescued explicitly.
|
307
|
+
#
|
308
|
+
# This workaround has a side effect: java exceptions specified
|
309
|
+
# in `Pry.config.exception_whitelist` are ignored.
|
310
|
+
jruby_exceptions = []
|
311
|
+
if Pry::Helpers::BaseHelpers.jruby?
|
312
|
+
jruby_exceptions << Java::JavaLang::Exception
|
313
|
+
end
|
300
314
|
|
301
|
-
loop do
|
302
315
|
begin
|
303
|
-
#
|
304
|
-
|
305
|
-
|
306
|
-
|
316
|
+
# Reset eval string, in case we're evaluating Ruby that does something
|
317
|
+
# like open a nested REPL on this instance.
|
318
|
+
eval_string = @eval_string
|
319
|
+
reset_eval_string
|
320
|
+
|
321
|
+
result = evaluate_ruby(eval_string)
|
322
|
+
rescue RescuableException, *jruby_exceptions => e
|
323
|
+
# Eliminate following warning:
|
324
|
+
# warning: singleton on non-persistent Java type X
|
325
|
+
# (http://wiki.jruby.org/Persistence)
|
326
|
+
if Pry::Helpers::BaseHelpers.jruby? && e.class.respond_to?('__persistent__')
|
327
|
+
e.class.__persistent__ = true
|
328
|
+
end
|
329
|
+
self.last_exception = e
|
330
|
+
result = e
|
307
331
|
end
|
308
332
|
|
309
|
-
|
310
|
-
|
311
|
-
rescue SyntaxError => e
|
312
|
-
output.puts "SyntaxError: #{e.message.sub(/.*syntax error, */m, '')}"
|
313
|
-
eval_string = ""
|
333
|
+
Pry.critical_section do
|
334
|
+
show_result(result)
|
314
335
|
end
|
315
336
|
end
|
316
337
|
|
317
|
-
|
338
|
+
throw(:breakout) if current_binding.nil?
|
339
|
+
end
|
340
|
+
private :handle_line
|
318
341
|
|
319
|
-
|
320
|
-
|
342
|
+
# Potentially deprecated — Use `Pry::REPL.new(pry, :target => target).start`
|
343
|
+
# (If nested sessions are going to exist, this method is fine, but a goal is
|
344
|
+
# to come up with an alternative to nested sessions altogether.)
|
345
|
+
def repl(target = nil)
|
346
|
+
Pry::REPL.new(self, :target => target).start
|
347
|
+
end
|
348
|
+
|
349
|
+
def evaluate_ruby(code)
|
350
|
+
inject_sticky_locals!
|
351
|
+
exec_hook :before_eval, code, self
|
352
|
+
|
353
|
+
result = current_binding.eval(code, Pry.eval_path, Pry.current_line)
|
354
|
+
set_last_result(result, code)
|
355
|
+
ensure
|
356
|
+
update_input_history(code)
|
357
|
+
exec_hook :after_eval, result, self
|
321
358
|
end
|
322
359
|
|
323
360
|
# Output the result or pass to an exception handler (if result is an exception).
|
324
361
|
def show_result(result)
|
325
362
|
if last_result_is_exception?
|
326
|
-
exception_handler.call
|
363
|
+
exception_handler.call(output, result, self)
|
364
|
+
elsif should_print?
|
365
|
+
print.call(output, result, self)
|
327
366
|
else
|
328
|
-
|
367
|
+
# nothin'
|
329
368
|
end
|
330
369
|
rescue RescuableException => e
|
331
370
|
# Being uber-paranoid here, given that this exception arose because we couldn't
|
@@ -340,95 +379,35 @@ class Pry
|
|
340
379
|
output.puts "(pry) output error: failed to show result"
|
341
380
|
end
|
342
381
|
end
|
382
|
+
ensure
|
383
|
+
output.flush if output.respond_to?(:flush)
|
343
384
|
end
|
344
385
|
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
# use, rewrite the indentation if `Pry.config.auto_indent` is enabled, and,
|
352
|
-
# if the line is a command, process it and alter the eval_string accordingly.
|
353
|
-
# This method should not need to be invoked directly.
|
354
|
-
#
|
355
|
-
# @param [String] eval_string The cumulative lines of input.
|
356
|
-
# @param [Binding] target The target of the session.
|
357
|
-
# @return [String] The line received.
|
358
|
-
def retrieve_line(eval_string, target)
|
359
|
-
@indent.reset if eval_string.empty?
|
360
|
-
|
361
|
-
current_prompt = select_prompt(eval_string, target)
|
362
|
-
completion_proc = Pry::InputCompleter.build_completion_proc(target,
|
363
|
-
instance_eval(&custom_completions))
|
364
|
-
|
365
|
-
|
366
|
-
indentation = Pry.config.auto_indent ? @indent.current_prefix : ''
|
367
|
-
|
368
|
-
begin
|
369
|
-
val = readline("#{current_prompt}#{indentation}", completion_proc)
|
370
|
-
|
371
|
-
# Handle <Ctrl+C> like Bash, empty the current input buffer but do not quit.
|
372
|
-
# This is only for ruby-1.9; other versions of ruby do not let you send Interrupt
|
373
|
-
# from within Readline.
|
374
|
-
rescue Interrupt
|
375
|
-
output.puts ""
|
376
|
-
eval_string.replace("")
|
377
|
-
return
|
378
|
-
end
|
379
|
-
|
380
|
-
# invoke handler if we receive EOF character (^D)
|
381
|
-
if !val
|
382
|
-
output.puts ""
|
383
|
-
Pry.config.control_d_handler.call(eval_string, self)
|
384
|
-
return
|
385
|
-
end
|
386
|
-
|
387
|
-
# Change the eval_string into the input encoding (Issue 284)
|
388
|
-
# TODO: This wouldn't be necessary if the eval_string was constructed from
|
389
|
-
# input strings only.
|
390
|
-
if should_force_encoding?(eval_string, val)
|
391
|
-
eval_string.force_encoding(val.encoding)
|
392
|
-
end
|
393
|
-
|
394
|
-
if Pry.config.auto_indent && !input.is_a?(StringIO)
|
395
|
-
original_val = "#{indentation}#{val}"
|
396
|
-
indented_val = @indent.indent(val)
|
397
|
-
|
398
|
-
if output.tty? && Pry::Helpers::BaseHelpers.use_ansi_codes? && Pry.config.correct_indent
|
399
|
-
output.print @indent.correct_indentation(current_prompt, indented_val, original_val.length - indented_val.length)
|
400
|
-
output.flush
|
401
|
-
end
|
402
|
-
else
|
403
|
-
indented_val = val
|
404
|
-
end
|
405
|
-
|
406
|
-
begin
|
407
|
-
if !process_command(val, eval_string, target)
|
408
|
-
eval_string << "#{indented_val.rstrip}\n" unless val.empty?
|
409
|
-
end
|
410
|
-
ensure
|
411
|
-
Pry.history << indented_val unless input.is_a?(StringIO)
|
386
|
+
# Force `eval_string` into the encoding of `val`. [Issue #284]
|
387
|
+
def ensure_correct_encoding!(val)
|
388
|
+
if @eval_string.empty? &&
|
389
|
+
val.respond_to?(:encoding) &&
|
390
|
+
val.encoding != @eval_string.encoding
|
391
|
+
@eval_string.force_encoding(val.encoding)
|
412
392
|
end
|
413
393
|
end
|
394
|
+
private :ensure_correct_encoding!
|
414
395
|
|
415
396
|
# If the given line is a valid command, process it in the context of the
|
416
|
-
# current `eval_string` and
|
417
|
-
# This method should not need to be invoked directly.
|
397
|
+
# current `eval_string` and binding.
|
418
398
|
# @param [String] val The line to process.
|
419
|
-
# @param [String] eval_string The cumulative lines of input.
|
420
|
-
# @param [Binding] target The target of the Pry session.
|
421
399
|
# @return [Boolean] `true` if `val` is a command, `false` otherwise
|
422
|
-
def process_command(val
|
423
|
-
|
424
|
-
|
400
|
+
def process_command(val)
|
401
|
+
val = val.chomp
|
402
|
+
result = commands.process_line(val,
|
403
|
+
:target => current_binding,
|
425
404
|
:output => output,
|
426
|
-
:eval_string => eval_string,
|
405
|
+
:eval_string => @eval_string,
|
427
406
|
:pry_instance => self
|
428
|
-
|
407
|
+
)
|
429
408
|
|
430
409
|
# set a temporary (just so we can inject the value we want into eval_string)
|
431
|
-
|
410
|
+
Pry.current[:pry_cmd_result] = result
|
432
411
|
|
433
412
|
# note that `result` wraps the result of command processing; if a
|
434
413
|
# command was matched and invoked then `result.command?` returns true,
|
@@ -438,7 +417,7 @@ class Pry
|
|
438
417
|
# the command that was invoked was non-void (had a return value) and so we make
|
439
418
|
# the value of the current expression equal to the return value
|
440
419
|
# of the command.
|
441
|
-
eval_string.replace "
|
420
|
+
@eval_string.replace "::Pry.current[:pry_cmd_result].retval\n"
|
442
421
|
end
|
443
422
|
true
|
444
423
|
else
|
@@ -446,17 +425,27 @@ class Pry
|
|
446
425
|
end
|
447
426
|
end
|
448
427
|
|
428
|
+
# Same as process_command, but outputs exceptions to `#output` instead of
|
429
|
+
# raising.
|
430
|
+
# @param [String] val The line to process.
|
431
|
+
# @return [Boolean] `true` if `val` is a command, `false` otherwise
|
432
|
+
def process_command_safely(val)
|
433
|
+
process_command(val)
|
434
|
+
rescue CommandError, Slop::InvalidOptionError, MethodSource::SourceNotFoundError => e
|
435
|
+
Pry.last_internal_error = e
|
436
|
+
output.puts "Error: #{e.message}"
|
437
|
+
true
|
438
|
+
end
|
439
|
+
|
449
440
|
# Run the specified command.
|
450
441
|
# @param [String] val The command (and its params) to execute.
|
451
|
-
# @param [String] eval_string The current input buffer.
|
452
|
-
# @param [Binding] target The binding to use..
|
453
442
|
# @return [Pry::Command::VOID_VALUE]
|
454
443
|
# @example
|
455
444
|
# pry_instance.run_command("ls -m")
|
456
|
-
def run_command(val
|
445
|
+
def run_command(val)
|
457
446
|
commands.process_line(val,
|
458
|
-
:eval_string => eval_string,
|
459
|
-
:target =>
|
447
|
+
:eval_string => @eval_string,
|
448
|
+
:target => current_binding,
|
460
449
|
:pry_instance => self,
|
461
450
|
:output => output
|
462
451
|
)
|
@@ -485,36 +474,25 @@ class Pry
|
|
485
474
|
# Set the last result of an eval.
|
486
475
|
# This method should not need to be invoked directly.
|
487
476
|
# @param [Object] result The result.
|
488
|
-
# @param [Binding] target The binding to set `_` on.
|
489
477
|
# @param [String] code The code that was run.
|
490
|
-
def set_last_result(result,
|
478
|
+
def set_last_result(result, code="")
|
491
479
|
@last_result_is_exception = false
|
492
480
|
@output_array << result
|
493
481
|
|
494
482
|
self.last_result = result unless code =~ /\A\s*\z/
|
495
483
|
end
|
496
484
|
|
485
|
+
#
|
497
486
|
# Set the last exception for a session.
|
498
|
-
#
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
[$1, $2.to_i]
|
505
|
-
end
|
506
|
-
|
507
|
-
def inc_bt_index
|
508
|
-
@bt_index = (@bt_index + 1) % backtrace.size
|
509
|
-
end
|
510
|
-
end
|
511
|
-
|
512
|
-
ex.bt_index = 0
|
513
|
-
ex.file, ex.line = ex.bt_source_location_for(0)
|
514
|
-
|
487
|
+
#
|
488
|
+
# @param [Exception] e
|
489
|
+
# the last exception.
|
490
|
+
#
|
491
|
+
def last_exception=(e)
|
492
|
+
last_exception = Pry::LastException.new(e)
|
515
493
|
@last_result_is_exception = true
|
516
|
-
@output_array <<
|
517
|
-
@last_exception =
|
494
|
+
@output_array << last_exception
|
495
|
+
@last_exception = last_exception
|
518
496
|
end
|
519
497
|
|
520
498
|
# Update Pry's internal state after evalling code.
|
@@ -536,105 +514,54 @@ class Pry
|
|
536
514
|
@last_result_is_exception
|
537
515
|
end
|
538
516
|
|
539
|
-
# Manage switching of input objects on encountering EOFErrors
|
540
|
-
def handle_read_errors
|
541
|
-
should_retry = true
|
542
|
-
exception_count = 0
|
543
|
-
begin
|
544
|
-
yield
|
545
|
-
rescue EOFError
|
546
|
-
if input_stack.empty?
|
547
|
-
self.input = Pry.config.input
|
548
|
-
if !should_retry
|
549
|
-
output.puts "Error: Pry ran out of things to read from! Attempting to break out of REPL."
|
550
|
-
throw(:breakout)
|
551
|
-
end
|
552
|
-
should_retry = false
|
553
|
-
else
|
554
|
-
self.input = input_stack.pop
|
555
|
-
end
|
556
|
-
|
557
|
-
retry
|
558
|
-
|
559
|
-
# Interrupts are handled in r() because they need to tweak eval_string
|
560
|
-
# TODO: Refactor this baby.
|
561
|
-
rescue Interrupt
|
562
|
-
raise
|
563
|
-
|
564
|
-
# If we get a random error when trying to read a line we don't want to automatically
|
565
|
-
# retry, as the user will see a lot of error messages scroll past and be unable to do
|
566
|
-
# anything about it.
|
567
|
-
rescue RescuableException => e
|
568
|
-
puts "Error: #{e.message}"
|
569
|
-
output.puts e.backtrace
|
570
|
-
exception_count += 1
|
571
|
-
if exception_count < 5
|
572
|
-
retry
|
573
|
-
end
|
574
|
-
puts "FATAL: Pry failed to get user input using `#{input}`."
|
575
|
-
puts "To fix this you may be able to pass input and output file descriptors to pry directly. e.g."
|
576
|
-
puts " Pry.config.input = STDIN"
|
577
|
-
puts " Pry.config.output = STDOUT"
|
578
|
-
puts " binding.pry"
|
579
|
-
throw(:breakout)
|
580
|
-
end
|
581
|
-
end
|
582
|
-
private :handle_read_errors
|
583
|
-
|
584
|
-
# Returns the next line of input to be used by the pry instance.
|
585
|
-
# This method should not need to be invoked directly.
|
586
|
-
# @param [String] current_prompt The prompt to use for input.
|
587
|
-
# @return [String] The next line of input.
|
588
|
-
def readline(current_prompt="> ", completion_proc=nil)
|
589
|
-
handle_read_errors do
|
590
|
-
|
591
|
-
if defined? Coolline and input.is_a? Coolline
|
592
|
-
input.completion_proc = proc do |cool|
|
593
|
-
completion_proc.call cool.completed_word
|
594
|
-
end
|
595
|
-
elsif input.respond_to? :completion_proc=
|
596
|
-
input.completion_proc = completion_proc
|
597
|
-
end
|
598
|
-
|
599
|
-
if input == Readline
|
600
|
-
input.readline(current_prompt, false) # false since we'll add it manually
|
601
|
-
elsif defined? Coolline and input.is_a? Coolline
|
602
|
-
input.readline(current_prompt)
|
603
|
-
else
|
604
|
-
if input.method(:readline).arity == 1
|
605
|
-
input.readline(current_prompt)
|
606
|
-
else
|
607
|
-
input.readline
|
608
|
-
end
|
609
|
-
end
|
610
|
-
end
|
611
|
-
end
|
612
|
-
|
613
517
|
# Whether the print proc should be invoked.
|
614
|
-
# Currently only invoked if the output is not suppressed
|
615
|
-
# is an exception regardless of suppression.
|
518
|
+
# Currently only invoked if the output is not suppressed.
|
616
519
|
# @return [Boolean] Whether the print proc should be invoked.
|
617
520
|
def should_print?
|
618
|
-
!@suppress_output
|
521
|
+
!@suppress_output
|
619
522
|
end
|
620
523
|
|
621
524
|
# Returns the appropriate prompt to use.
|
622
|
-
# This method should not need to be invoked directly.
|
623
|
-
# @param [String] eval_string The current input buffer.
|
624
|
-
# @param [Binding] target The target Binding of the Pry session.
|
625
525
|
# @return [String] The prompt.
|
626
|
-
def select_prompt
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
526
|
+
def select_prompt
|
527
|
+
object = current_binding.eval('self')
|
528
|
+
|
529
|
+
open_token = @indent.open_delimiters.any? ? @indent.open_delimiters.last :
|
530
|
+
@indent.stack.last
|
531
|
+
|
532
|
+
c = Pry::Config.from_hash({
|
533
|
+
:object => object,
|
534
|
+
:nesting_level => binding_stack.size - 1,
|
535
|
+
:open_token => open_token,
|
536
|
+
:session_line => Pry.history.session_line_count + 1,
|
537
|
+
:history_line => Pry.history.history_line_count + 1,
|
538
|
+
:expr_number => input_array.count,
|
539
|
+
:_pry_ => self,
|
540
|
+
:binding_stack => binding_stack,
|
541
|
+
:input_array => input_array,
|
542
|
+
:eval_string => @eval_string,
|
543
|
+
:cont => !@eval_string.empty?})
|
544
|
+
|
545
|
+
Pry.critical_section do
|
546
|
+
# If input buffer is empty then use normal prompt
|
547
|
+
if eval_string.empty?
|
548
|
+
generate_prompt(Array(prompt).first, c)
|
549
|
+
|
550
|
+
# Otherwise use the wait prompt (indicating multi-line expression)
|
551
|
+
else
|
552
|
+
generate_prompt(Array(prompt).last, c)
|
553
|
+
end
|
554
|
+
end
|
555
|
+
end
|
632
556
|
|
633
|
-
|
557
|
+
def generate_prompt(prompt_proc, conf)
|
558
|
+
if prompt_proc.arity == 1
|
559
|
+
prompt_proc.call(conf)
|
634
560
|
else
|
635
|
-
|
561
|
+
prompt_proc.call(conf.object, conf.nesting_level, conf._pry_)
|
636
562
|
end
|
637
563
|
end
|
564
|
+
private :generate_prompt
|
638
565
|
|
639
566
|
# the array that the prompt stack is stored in
|
640
567
|
def prompt_stack
|
@@ -669,6 +596,20 @@ class Pry
|
|
669
596
|
prompt_stack.size > 1 ? prompt_stack.pop : prompt
|
670
597
|
end
|
671
598
|
|
599
|
+
# Returns the currently configured pager
|
600
|
+
# @example
|
601
|
+
# _pry_.pager.page text
|
602
|
+
def pager
|
603
|
+
Pry::Pager.new(self)
|
604
|
+
end
|
605
|
+
|
606
|
+
# Returns an output device
|
607
|
+
# @example
|
608
|
+
# _pry_.output.puts "ohai!"
|
609
|
+
def output
|
610
|
+
Pry::Output.new(self)
|
611
|
+
end
|
612
|
+
|
672
613
|
# Raise an exception out of Pry.
|
673
614
|
#
|
674
615
|
# See Kernel#raise for documentation of parameters.
|