pry 0.10.2-i386-mingw32 → 1.0.0.pre1-i386-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +2 -0
- data/.gitignore +16 -0
- data/.travis.yml +21 -0
- data/.yardopts +3 -0
- data/CHANGELOG +503 -0
- data/CONTRIBUTORS +55 -0
- data/Gemfile +9 -0
- data/Guardfile +62 -0
- data/LICENSE +2 -2
- data/{README.md → README.markdown} +31 -37
- data/Rakefile +144 -0
- data/TODO +117 -0
- data/lib/pry.rb +146 -33
- data/lib/pry/cli.rb +13 -35
- data/lib/pry/code.rb +63 -24
- data/lib/pry/code/loc.rb +2 -2
- data/lib/pry/code_object.rb +21 -40
- data/lib/pry/command.rb +6 -9
- data/lib/pry/command_set.rb +37 -80
- data/lib/pry/commands.rb +1 -1
- data/lib/pry/commands/amend_line.rb +1 -1
- data/lib/pry/commands/bang.rb +1 -1
- data/lib/pry/commands/cat.rb +2 -11
- data/lib/pry/commands/cat/abstract_formatter.rb +1 -1
- data/lib/pry/commands/cat/exception_formatter.rb +7 -6
- data/lib/pry/commands/cat/file_formatter.rb +32 -15
- data/lib/pry/commands/cat/input_expression_formatter.rb +1 -1
- data/lib/pry/commands/cd.rb +3 -14
- data/lib/pry/commands/code_collector.rb +4 -4
- data/lib/pry/commands/easter_eggs.rb +3 -3
- data/lib/pry/commands/edit.rb +22 -10
- data/lib/pry/commands/edit/exception_patcher.rb +1 -1
- data/lib/pry/commands/edit/file_and_line_locator.rb +2 -0
- data/lib/pry/{method/patcher.rb → commands/edit/method_patcher.rb} +37 -40
- data/lib/pry/commands/find_method.rb +22 -16
- data/lib/pry/commands/gem_install.rb +2 -5
- data/lib/pry/commands/gem_open.rb +1 -1
- data/lib/pry/commands/gist.rb +11 -10
- data/lib/pry/commands/help.rb +14 -14
- data/lib/pry/commands/hist.rb +5 -24
- data/lib/pry/commands/ls.rb +287 -56
- data/lib/pry/commands/play.rb +10 -44
- data/lib/pry/commands/pry_backtrace.rb +2 -1
- data/lib/pry/commands/raise_up.rb +1 -1
- data/lib/pry/commands/reload_code.rb +15 -31
- data/lib/pry/commands/ri.rb +3 -7
- data/lib/pry/commands/shell_command.rb +12 -17
- data/lib/pry/commands/shell_mode.rb +2 -2
- data/lib/pry/commands/show_doc.rb +0 -5
- data/lib/pry/commands/show_info.rb +10 -11
- data/lib/pry/commands/show_source.rb +3 -15
- data/lib/pry/commands/simple_prompt.rb +1 -1
- data/lib/pry/commands/toggle_color.rb +4 -8
- data/lib/pry/commands/whereami.rb +10 -18
- data/lib/pry/completion.rb +293 -0
- data/lib/pry/config.rb +233 -20
- data/lib/pry/core_extensions.rb +19 -29
- data/lib/pry/custom_completions.rb +6 -0
- data/lib/pry/editor.rb +103 -109
- data/lib/pry/helpers/base_helpers.rb +109 -22
- data/lib/pry/helpers/command_helpers.rb +8 -10
- data/lib/pry/helpers/documentation_helpers.rb +2 -1
- data/lib/pry/helpers/text.rb +5 -4
- data/lib/pry/history.rb +10 -21
- data/lib/pry/history_array.rb +0 -5
- data/lib/pry/hooks.rb +29 -9
- data/lib/pry/indent.rb +10 -5
- data/lib/pry/method.rb +86 -81
- data/lib/pry/method/weird_method_locator.rb +2 -4
- data/lib/pry/module_candidate.rb +14 -5
- data/lib/pry/pager.rb +48 -193
- data/lib/pry/plugins.rb +2 -2
- data/lib/pry/pry_class.rb +193 -104
- data/lib/pry/pry_instance.rb +154 -152
- data/lib/pry/rbx_method.rb +13 -0
- data/lib/pry/rbx_path.rb +1 -1
- data/lib/pry/repl.rb +14 -17
- data/lib/pry/repl_file_loader.rb +3 -8
- data/lib/pry/rubygem.rb +3 -3
- data/lib/pry/terminal.rb +3 -4
- data/lib/pry/test/helper.rb +11 -6
- data/lib/pry/version.rb +1 -1
- data/lib/pry/wrapped_module.rb +56 -49
- data/man/pry.1 +195 -0
- data/man/pry.1.html +204 -0
- data/man/pry.1.ronn +141 -0
- data/pry.gemspec +31 -0
- data/spec/Procfile +3 -0
- data/spec/cli_spec.rb +78 -0
- data/spec/code_object_spec.rb +277 -0
- data/spec/code_spec.rb +219 -0
- data/spec/command_helpers_spec.rb +29 -0
- data/spec/command_integration_spec.rb +562 -0
- data/spec/command_set_spec.rb +627 -0
- data/spec/command_spec.rb +821 -0
- data/spec/commands/amend_line_spec.rb +247 -0
- data/spec/commands/bang_spec.rb +18 -0
- data/spec/commands/cat_spec.rb +164 -0
- data/spec/commands/cd_spec.rb +250 -0
- data/spec/commands/disable_pry_spec.rb +25 -0
- data/spec/commands/edit_spec.rb +725 -0
- data/spec/commands/exit_all_spec.rb +27 -0
- data/spec/commands/exit_program_spec.rb +19 -0
- data/spec/commands/exit_spec.rb +28 -0
- data/spec/commands/find_method_spec.rb +70 -0
- data/spec/commands/gem_list_spec.rb +26 -0
- data/spec/commands/gist_spec.rb +79 -0
- data/spec/commands/help_spec.rb +56 -0
- data/spec/commands/hist_spec.rb +172 -0
- data/spec/commands/jump_to_spec.rb +15 -0
- data/spec/commands/ls_spec.rb +189 -0
- data/spec/commands/play_spec.rb +136 -0
- data/spec/commands/raise_up_spec.rb +56 -0
- data/spec/commands/save_file_spec.rb +177 -0
- data/spec/commands/show_doc_spec.rb +488 -0
- data/spec/commands/show_input_spec.rb +17 -0
- data/spec/commands/show_source_spec.rb +760 -0
- data/spec/commands/whereami_spec.rb +203 -0
- data/spec/completion_spec.rb +221 -0
- data/spec/control_d_handler_spec.rb +62 -0
- data/spec/documentation_helper_spec.rb +73 -0
- data/spec/editor_spec.rb +79 -0
- data/spec/exception_whitelist_spec.rb +21 -0
- data/spec/fixtures/candidate_helper1.rb +11 -0
- data/spec/fixtures/candidate_helper2.rb +8 -0
- data/spec/fixtures/example.erb +5 -0
- data/spec/fixtures/example_nesting.rb +33 -0
- data/spec/fixtures/show_source_doc_examples.rb +15 -0
- data/spec/fixtures/testlinkrc +2 -0
- data/spec/fixtures/testrc +2 -0
- data/spec/fixtures/testrcbad +2 -0
- data/spec/fixtures/whereami_helper.rb +6 -0
- data/spec/helper.rb +35 -0
- data/spec/helpers/bacon.rb +86 -0
- data/spec/helpers/mock_pry.rb +44 -0
- data/spec/helpers/repl_tester.rb +112 -0
- data/spec/helpers/table_spec.rb +105 -0
- data/spec/history_array_spec.rb +67 -0
- data/spec/hooks_spec.rb +522 -0
- data/spec/indent_spec.rb +301 -0
- data/spec/method_spec.rb +482 -0
- data/spec/prompt_spec.rb +61 -0
- data/spec/pry_defaults_spec.rb +420 -0
- data/spec/pry_history_spec.rb +69 -0
- data/spec/pry_output_spec.rb +95 -0
- data/spec/pry_repl_spec.rb +86 -0
- data/spec/pry_spec.rb +394 -0
- data/spec/pryrc_spec.rb +97 -0
- data/spec/run_command_spec.rb +25 -0
- data/spec/sticky_locals_spec.rb +147 -0
- data/spec/syntax_checking_spec.rb +81 -0
- data/spec/wrapped_module_spec.rb +261 -0
- data/wiki/Customizing-pry.md +397 -0
- data/wiki/Home.md +4 -0
- metadata +272 -61
- checksums.yaml +0 -7
- data/CHANGELOG.md +0 -714
- data/lib/pry/code/code_file.rb +0 -103
- data/lib/pry/color_printer.rb +0 -55
- data/lib/pry/commands/change_inspector.rb +0 -27
- data/lib/pry/commands/change_prompt.rb +0 -26
- data/lib/pry/commands/list_inspectors.rb +0 -35
- data/lib/pry/commands/list_prompts.rb +0 -35
- data/lib/pry/commands/ls/constants.rb +0 -47
- data/lib/pry/commands/ls/formatter.rb +0 -49
- data/lib/pry/commands/ls/globals.rb +0 -48
- data/lib/pry/commands/ls/grep.rb +0 -21
- data/lib/pry/commands/ls/instance_vars.rb +0 -39
- data/lib/pry/commands/ls/interrogatable.rb +0 -18
- data/lib/pry/commands/ls/jruby_hacks.rb +0 -49
- data/lib/pry/commands/ls/local_names.rb +0 -35
- data/lib/pry/commands/ls/local_vars.rb +0 -39
- data/lib/pry/commands/ls/ls_entity.rb +0 -70
- data/lib/pry/commands/ls/methods.rb +0 -57
- data/lib/pry/commands/ls/methods_helper.rb +0 -46
- data/lib/pry/commands/ls/self_methods.rb +0 -32
- data/lib/pry/commands/watch_expression.rb +0 -105
- data/lib/pry/commands/watch_expression/expression.rb +0 -38
- data/lib/pry/config/behavior.rb +0 -139
- data/lib/pry/config/convenience.rb +0 -25
- data/lib/pry/config/default.rb +0 -161
- data/lib/pry/exceptions.rb +0 -78
- data/lib/pry/input_completer.rb +0 -242
- data/lib/pry/input_lock.rb +0 -132
- data/lib/pry/inspector.rb +0 -27
- data/lib/pry/last_exception.rb +0 -61
- data/lib/pry/object_path.rb +0 -82
- data/lib/pry/output.rb +0 -50
- data/lib/pry/prompt.rb +0 -26
data/lib/pry/input_lock.rb
DELETED
@@ -1,132 +0,0 @@
|
|
1
|
-
require 'thread'
|
2
|
-
|
3
|
-
class Pry
|
4
|
-
# There is one InputLock per input (such as STDIN) as two REPLs on the same
|
5
|
-
# input makes things delirious. InputLock serializes accesses to the input so
|
6
|
-
# that threads to not conflict with each other. The latest thread to request
|
7
|
-
# ownership of the input wins.
|
8
|
-
class InputLock
|
9
|
-
class Interrupt < Exception; end
|
10
|
-
|
11
|
-
class << self
|
12
|
-
attr_accessor :input_locks
|
13
|
-
attr_accessor :global_lock
|
14
|
-
end
|
15
|
-
|
16
|
-
self.input_locks = {}
|
17
|
-
self.global_lock = Mutex.new
|
18
|
-
|
19
|
-
def self.for(input)
|
20
|
-
# XXX This method leaks memory, as we never unregister an input once we
|
21
|
-
# are done with it. Fortunately, the leak is tiny (or so we hope). In
|
22
|
-
# usual scenarios, we would leak the StringIO that is passed to be
|
23
|
-
# evaluated from the command line.
|
24
|
-
global_lock.synchronize do
|
25
|
-
input_locks[input] ||= Pry::InputLock.new
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def initialize
|
30
|
-
@mutex = Mutex.new
|
31
|
-
@cond = ConditionVariable.new
|
32
|
-
@owners = []
|
33
|
-
@interruptible = false
|
34
|
-
end
|
35
|
-
|
36
|
-
# Adds ourselves to the ownership list. The last one in the list may access
|
37
|
-
# the input through interruptible_region().
|
38
|
-
def __with_ownership(&block)
|
39
|
-
@mutex.synchronize do
|
40
|
-
# Three cases:
|
41
|
-
# 1) There are no owners, in this case we are good to go.
|
42
|
-
# 2) The current owner of the input is not reading the input (it might
|
43
|
-
# just be evaluating some ruby that the user typed).
|
44
|
-
# The current owner will figure out that it cannot go back to reading
|
45
|
-
# the input since we are adding ourselves to the @owners list, which
|
46
|
-
# in turns makes us the current owner.
|
47
|
-
# 3) The owner of the input is in the interruptible region, reading from
|
48
|
-
# the input. It's safe to send an Interrupt exception to interrupt
|
49
|
-
# the owner. It will then proceed like in case 2).
|
50
|
-
# We wait until the owner sets the interruptible flag back
|
51
|
-
# to false, meaning that he's out of the interruptible region.
|
52
|
-
# Note that the owner may receive multiple interrupts since, but that
|
53
|
-
# should be okay (and trying to avoid it is futile anyway).
|
54
|
-
while @interruptible
|
55
|
-
@owners.last.raise Interrupt
|
56
|
-
@cond.wait(@mutex)
|
57
|
-
end
|
58
|
-
@owners << Thread.current
|
59
|
-
end
|
60
|
-
|
61
|
-
block.call
|
62
|
-
|
63
|
-
ensure
|
64
|
-
@mutex.synchronize do
|
65
|
-
# We are releasing any desire to have the input ownership by removing
|
66
|
-
# ourselves from the list.
|
67
|
-
@owners.delete(Thread.current)
|
68
|
-
|
69
|
-
# We need to wake up the thread at the end of the @owners list, but
|
70
|
-
# sadly Ruby doesn't allow us to choose which one we wake up, so we wake
|
71
|
-
# them all up.
|
72
|
-
@cond.broadcast
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def with_ownership(&block)
|
77
|
-
# If we are in a nested with_ownership() call (nested pry context), we do nothing.
|
78
|
-
nested = @mutex.synchronize { @owners.include?(Thread.current) }
|
79
|
-
nested ? block.call : __with_ownership(&block)
|
80
|
-
end
|
81
|
-
|
82
|
-
def enter_interruptible_region
|
83
|
-
@mutex.synchronize do
|
84
|
-
# We patiently wait until we are the owner. This may happen as another
|
85
|
-
# thread calls with_ownership() because of a binding.pry happening in
|
86
|
-
# another thread.
|
87
|
-
@cond.wait(@mutex) until @owners.last == Thread.current
|
88
|
-
|
89
|
-
# We are the legitimate owner of the input. We mark ourselves as
|
90
|
-
# interruptible, so other threads can send us an Interrupt exception
|
91
|
-
# while we are blocking from reading the input.
|
92
|
-
@interruptible = true
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def leave_interruptible_region
|
97
|
-
@mutex.synchronize do
|
98
|
-
# We check if we are still the owner, because we could have received an
|
99
|
-
# Interrupt right after the following @cond.broadcast, making us retry.
|
100
|
-
@interruptible = false if @owners.last == Thread.current
|
101
|
-
@cond.broadcast
|
102
|
-
end
|
103
|
-
rescue Interrupt
|
104
|
-
# We need to guard against a spurious interrupt delivered while we are
|
105
|
-
# trying to acquire the lock (the rescue block is no longer in our scope).
|
106
|
-
retry
|
107
|
-
end
|
108
|
-
|
109
|
-
def interruptible_region(&block)
|
110
|
-
enter_interruptible_region
|
111
|
-
|
112
|
-
# XXX Note that there is a chance that we get the interrupt right after
|
113
|
-
# the readline call succeeded, but we'll never know, and we will retry the
|
114
|
-
# call, discarding that piece of input.
|
115
|
-
block.call
|
116
|
-
|
117
|
-
rescue Interrupt
|
118
|
-
# We were asked to back off. The one requesting the interrupt will be
|
119
|
-
# waiting on the conditional for the interruptible flag to change to false.
|
120
|
-
# Note that there can be some inefficiency, as we could immediately
|
121
|
-
# succeed in enter_interruptible_region(), even before the one requesting
|
122
|
-
# the ownership has the chance to register itself as an owner.
|
123
|
-
# To mitigate the issue, we sleep a little bit.
|
124
|
-
leave_interruptible_region
|
125
|
-
sleep 0.01
|
126
|
-
retry
|
127
|
-
|
128
|
-
ensure
|
129
|
-
leave_interruptible_region
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
data/lib/pry/inspector.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
class Pry::Inspector
|
2
|
-
MAP = {
|
3
|
-
"default" => {
|
4
|
-
value: Pry::DEFAULT_PRINT,
|
5
|
-
description: <<-DESCRIPTION.each_line.map(&:lstrip!)
|
6
|
-
The default Pry inspector. It has paging and color support, and uses
|
7
|
-
pretty_inspect when printing an object.
|
8
|
-
DESCRIPTION
|
9
|
-
},
|
10
|
-
|
11
|
-
"simple" => {
|
12
|
-
value: Pry::SIMPLE_PRINT,
|
13
|
-
description: <<-DESCRIPTION.each_line.map(&:lstrip)
|
14
|
-
A simple inspector that uses #puts and #inspect when printing an
|
15
|
-
object. It has no pager, color, or pretty_inspect support.
|
16
|
-
DESCRIPTION
|
17
|
-
},
|
18
|
-
|
19
|
-
"clipped" => {
|
20
|
-
value: Pry::CLIPPED_PRINT,
|
21
|
-
description: <<-DESCRIPTION.each_line.map(&:lstrip)
|
22
|
-
The clipped inspector has the same features as the 'simple' inspector
|
23
|
-
but prints large objects as a smaller string.
|
24
|
-
DESCRIPTION
|
25
|
-
}
|
26
|
-
}
|
27
|
-
end
|
data/lib/pry/last_exception.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# {Pry::LastException} is a proxy class who wraps an Exception object for
|
3
|
-
# {Pry#last_exception}. it extends the exception object with methods that
|
4
|
-
# help pry commands be useful.
|
5
|
-
#
|
6
|
-
# the original exception object is not modified and method calls are forwarded
|
7
|
-
# to the wrapped exception object.
|
8
|
-
#
|
9
|
-
class Pry::LastException < BasicObject
|
10
|
-
attr_accessor :bt_index
|
11
|
-
|
12
|
-
def initialize(e)
|
13
|
-
@e = e
|
14
|
-
@bt_index = 0
|
15
|
-
@file, @line = bt_source_location_for(0)
|
16
|
-
end
|
17
|
-
|
18
|
-
def method_missing(name, *args, &block)
|
19
|
-
if @e.respond_to?(name)
|
20
|
-
@e.public_send(name, *args, &block)
|
21
|
-
else
|
22
|
-
super
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def respond_to_missing?(name, include_private = false)
|
27
|
-
@e.respond_to?(name)
|
28
|
-
end
|
29
|
-
|
30
|
-
#
|
31
|
-
# @return [String]
|
32
|
-
# returns the path to a file for the current backtrace. see {#bt_index}.
|
33
|
-
#
|
34
|
-
def file
|
35
|
-
@file
|
36
|
-
end
|
37
|
-
|
38
|
-
#
|
39
|
-
# @return [Fixnum]
|
40
|
-
# returns the line for the current backtrace. see {#bt_index}.
|
41
|
-
#
|
42
|
-
def line
|
43
|
-
@line
|
44
|
-
end
|
45
|
-
|
46
|
-
# @return [Exception]
|
47
|
-
# returns the wrapped exception
|
48
|
-
#
|
49
|
-
def wrapped_exception
|
50
|
-
@e
|
51
|
-
end
|
52
|
-
|
53
|
-
def bt_source_location_for(index)
|
54
|
-
backtrace[index] =~ /(.*):(\d+)/
|
55
|
-
[$1, $2.to_i]
|
56
|
-
end
|
57
|
-
|
58
|
-
def inc_bt_index
|
59
|
-
@bt_index = (@bt_index + 1) % backtrace.size
|
60
|
-
end
|
61
|
-
end
|
data/lib/pry/object_path.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
class Pry
|
2
|
-
# `ObjectPath` implements the resolution of "object paths", which are strings
|
3
|
-
# that are similar to filesystem paths but meant for traversing Ruby objects.
|
4
|
-
# Examples of valid object paths include:
|
5
|
-
#
|
6
|
-
# x
|
7
|
-
# @foo/@bar
|
8
|
-
# "string"/upcase
|
9
|
-
# Pry/Method
|
10
|
-
#
|
11
|
-
# Object paths are mostly relevant in the context of the `cd` command.
|
12
|
-
# @see https://github.com/pry/pry/wiki/State-navigation
|
13
|
-
class ObjectPath
|
14
|
-
SPECIAL_TERMS = ["", "::", ".", ".."]
|
15
|
-
|
16
|
-
# @param [String] path_string The object path expressed as a string.
|
17
|
-
# @param [Array<Binding>] current_stack The current state of the binding
|
18
|
-
# stack.
|
19
|
-
def initialize(path_string, current_stack)
|
20
|
-
@path_string = path_string
|
21
|
-
@current_stack = current_stack
|
22
|
-
end
|
23
|
-
|
24
|
-
# @return [Array<Binding>] a new stack resulting from applying the given
|
25
|
-
# path to the current stack.
|
26
|
-
def resolve
|
27
|
-
scanner = StringScanner.new(@path_string.strip)
|
28
|
-
stack = @current_stack.dup
|
29
|
-
|
30
|
-
begin
|
31
|
-
next_segment = ""
|
32
|
-
|
33
|
-
loop do
|
34
|
-
# Scan for as long as we don't see a slash
|
35
|
-
next_segment << scanner.scan(/[^\/]*/)
|
36
|
-
|
37
|
-
if complete?(next_segment) || scanner.eos?
|
38
|
-
scanner.getch # consume the slash
|
39
|
-
break
|
40
|
-
else
|
41
|
-
next_segment << scanner.getch # append the slash
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
case next_segment.chomp
|
46
|
-
when ""
|
47
|
-
stack = [stack.first]
|
48
|
-
when "::"
|
49
|
-
stack.push(TOPLEVEL_BINDING)
|
50
|
-
when "."
|
51
|
-
next
|
52
|
-
when ".."
|
53
|
-
stack.pop unless stack.size == 1
|
54
|
-
else
|
55
|
-
stack.push(Pry.binding_for(stack.last.eval(next_segment)))
|
56
|
-
end
|
57
|
-
rescue RescuableException => e
|
58
|
-
return handle_failure(next_segment, e)
|
59
|
-
end until scanner.eos?
|
60
|
-
|
61
|
-
stack
|
62
|
-
end
|
63
|
-
|
64
|
-
private
|
65
|
-
|
66
|
-
def complete?(segment)
|
67
|
-
SPECIAL_TERMS.include?(segment) || Pry::Code.complete_expression?(segment)
|
68
|
-
end
|
69
|
-
|
70
|
-
def handle_failure(context, err)
|
71
|
-
msg = [
|
72
|
-
"Bad object path: #{@path_string.inspect}",
|
73
|
-
"Failed trying to resolve: #{context.inspect}",
|
74
|
-
"Exception: #{err.inspect}"
|
75
|
-
].join("\n")
|
76
|
-
|
77
|
-
raise CommandError.new(msg).tap { |e|
|
78
|
-
e.set_backtrace err.backtrace
|
79
|
-
}
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
data/lib/pry/output.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
class Pry
|
2
|
-
class Output
|
3
|
-
attr_reader :_pry_
|
4
|
-
|
5
|
-
def initialize(_pry_)
|
6
|
-
@_pry_ = _pry_
|
7
|
-
end
|
8
|
-
|
9
|
-
def puts(*objs)
|
10
|
-
return print "\n" if objs.empty?
|
11
|
-
|
12
|
-
objs.each do |obj|
|
13
|
-
if ary = Array.try_convert(obj)
|
14
|
-
puts(*ary)
|
15
|
-
else
|
16
|
-
print "#{obj.to_s.chomp}\n"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
nil
|
21
|
-
end
|
22
|
-
|
23
|
-
def print(*objs)
|
24
|
-
objs.each do |obj|
|
25
|
-
_pry_.config.output.print decolorize_maybe(obj.to_s)
|
26
|
-
end
|
27
|
-
|
28
|
-
nil
|
29
|
-
end
|
30
|
-
alias << print
|
31
|
-
alias write print
|
32
|
-
|
33
|
-
# If _pry_.config.color is currently false, removes ansi escapes from the string.
|
34
|
-
def decolorize_maybe(str)
|
35
|
-
if _pry_.config.color
|
36
|
-
str
|
37
|
-
else
|
38
|
-
Helpers::Text.strip_color str
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def method_missing(name, *args, &block)
|
43
|
-
_pry_.config.output.send(name, *args, &block)
|
44
|
-
end
|
45
|
-
|
46
|
-
def respond_to_missing?(*a)
|
47
|
-
_pry_.config.respond_to?(*a)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
data/lib/pry/prompt.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
class Pry::Prompt
|
2
|
-
MAP = {
|
3
|
-
"default" => {
|
4
|
-
value: Pry::DEFAULT_PROMPT,
|
5
|
-
description: "The default Pry prompt. Includes information about the\n" \
|
6
|
-
"current expression number, evaluation context, and nesting\n" \
|
7
|
-
"level, plus a reminder that you're using Pry."
|
8
|
-
},
|
9
|
-
|
10
|
-
"simple" => {
|
11
|
-
value: Pry::SIMPLE_PROMPT,
|
12
|
-
description: "A simple '>>'."
|
13
|
-
},
|
14
|
-
|
15
|
-
"nav" => {
|
16
|
-
value: Pry::NAV_PROMPT,
|
17
|
-
description: "A prompt that displays the binding stack as a path and\n" \
|
18
|
-
"includes information about _in_ and _out_."
|
19
|
-
},
|
20
|
-
|
21
|
-
"none" => {
|
22
|
-
value: Pry::NO_PROMPT,
|
23
|
-
description: "Wave goodbye to the Pry prompt."
|
24
|
-
}
|
25
|
-
}
|
26
|
-
end
|