pry 0.11.3-java → 0.12.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +139 -1
  3. data/LICENSE +1 -1
  4. data/README.md +13 -30
  5. data/bin/pry +0 -4
  6. data/lib/pry.rb +17 -47
  7. data/lib/pry/cli.rb +17 -24
  8. data/lib/pry/code.rb +6 -6
  9. data/lib/pry/code/code_file.rb +5 -4
  10. data/lib/pry/code/code_range.rb +3 -3
  11. data/lib/pry/code/loc.rb +14 -8
  12. data/lib/pry/code_object.rb +4 -4
  13. data/lib/pry/color_printer.rb +1 -0
  14. data/lib/pry/command.rb +36 -29
  15. data/lib/pry/command_set.rb +17 -52
  16. data/lib/pry/commands/amend_line.rb +3 -4
  17. data/lib/pry/commands/bang.rb +1 -1
  18. data/lib/pry/commands/cat.rb +7 -6
  19. data/lib/pry/commands/cat/exception_formatter.rb +9 -8
  20. data/lib/pry/commands/cat/input_expression_formatter.rb +1 -1
  21. data/lib/pry/commands/change_prompt.rb +29 -9
  22. data/lib/pry/commands/clear_screen.rb +14 -0
  23. data/lib/pry/commands/code_collector.rb +9 -9
  24. data/lib/pry/commands/easter_eggs.rb +3 -3
  25. data/lib/pry/commands/edit.rb +8 -7
  26. data/lib/pry/commands/exit.rb +2 -1
  27. data/lib/pry/commands/find_method.rb +11 -13
  28. data/lib/pry/commands/gem_cd.rb +1 -1
  29. data/lib/pry/commands/gem_install.rb +2 -2
  30. data/lib/pry/commands/gem_list.rb +2 -2
  31. data/lib/pry/commands/gem_open.rb +1 -1
  32. data/lib/pry/commands/gem_search.rb +2 -2
  33. data/lib/pry/commands/gem_stats.rb +83 -0
  34. data/lib/pry/commands/gist.rb +7 -6
  35. data/lib/pry/commands/help.rb +3 -3
  36. data/lib/pry/commands/hist.rb +9 -8
  37. data/lib/pry/commands/import_set.rb +2 -1
  38. data/lib/pry/commands/install_command.rb +7 -6
  39. data/lib/pry/commands/list_inspectors.rb +2 -2
  40. data/lib/pry/commands/ls.rb +27 -30
  41. data/lib/pry/commands/ls/constants.rb +4 -4
  42. data/lib/pry/commands/ls/formatter.rb +3 -2
  43. data/lib/pry/commands/ls/globals.rb +0 -2
  44. data/lib/pry/commands/ls/grep.rb +0 -2
  45. data/lib/pry/commands/ls/instance_vars.rb +0 -1
  46. data/lib/pry/commands/ls/local_names.rb +0 -2
  47. data/lib/pry/commands/ls/local_vars.rb +0 -2
  48. data/lib/pry/commands/ls/ls_entity.rb +0 -1
  49. data/lib/pry/commands/ls/methods.rb +0 -3
  50. data/lib/pry/commands/ls/methods_helper.rb +1 -1
  51. data/lib/pry/commands/ls/self_methods.rb +0 -1
  52. data/lib/pry/commands/play.rb +1 -2
  53. data/lib/pry/commands/pry_backtrace.rb +1 -1
  54. data/lib/pry/commands/raise_up.rb +2 -1
  55. data/lib/pry/commands/ri.rb +5 -4
  56. data/lib/pry/commands/shell_command.rb +3 -2
  57. data/lib/pry/commands/shell_mode.rb +6 -6
  58. data/lib/pry/commands/show_doc.rb +5 -7
  59. data/lib/pry/commands/show_info.rb +25 -18
  60. data/lib/pry/commands/show_source.rb +5 -2
  61. data/lib/pry/commands/stat.rb +1 -1
  62. data/lib/pry/commands/watch_expression.rb +9 -7
  63. data/lib/pry/commands/whereami.rb +4 -4
  64. data/lib/pry/commands/wtf.rb +15 -2
  65. data/lib/pry/config.rb +33 -9
  66. data/lib/pry/config/behavior.rb +229 -205
  67. data/lib/pry/config/convenience.rb +24 -21
  68. data/lib/pry/config/default.rb +153 -143
  69. data/lib/pry/config/memoization.rb +41 -37
  70. data/lib/pry/core_extensions.rb +4 -3
  71. data/lib/pry/editor.rb +5 -12
  72. data/lib/pry/exceptions.rb +0 -2
  73. data/lib/pry/helpers.rb +1 -0
  74. data/lib/pry/helpers/base_helpers.rb +133 -4
  75. data/lib/pry/helpers/command_helpers.rb +5 -4
  76. data/lib/pry/helpers/documentation_helpers.rb +2 -2
  77. data/lib/pry/helpers/options_helpers.rb +5 -5
  78. data/lib/pry/helpers/platform.rb +58 -0
  79. data/lib/pry/helpers/table.rb +20 -15
  80. data/lib/pry/helpers/text.rb +3 -4
  81. data/lib/pry/history.rb +21 -8
  82. data/lib/pry/hooks.rb +3 -3
  83. data/lib/pry/indent.rb +15 -17
  84. data/lib/pry/input_completer.rb +12 -7
  85. data/lib/pry/input_lock.rb +0 -2
  86. data/lib/pry/last_exception.rb +1 -1
  87. data/lib/pry/method.rb +37 -31
  88. data/lib/pry/method/disowned.rb +2 -1
  89. data/lib/pry/method/patcher.rb +2 -2
  90. data/lib/pry/method/weird_method_locator.rb +7 -8
  91. data/lib/pry/object_path.rb +5 -4
  92. data/lib/pry/output.rb +3 -2
  93. data/lib/pry/pager.rb +4 -3
  94. data/lib/pry/platform.rb +79 -81
  95. data/lib/pry/plugins.rb +7 -3
  96. data/lib/pry/prompt.rb +144 -25
  97. data/lib/pry/pry_class.rb +53 -29
  98. data/lib/pry/pry_instance.rb +88 -55
  99. data/lib/pry/repl.rb +33 -4
  100. data/lib/pry/repl_file_loader.rb +1 -2
  101. data/lib/pry/ring.rb +84 -0
  102. data/lib/pry/rubygem.rb +6 -6
  103. data/lib/pry/slop.rb +17 -17
  104. data/lib/pry/slop/commands.rb +3 -4
  105. data/lib/pry/slop/option.rb +19 -21
  106. data/lib/pry/terminal.rb +2 -1
  107. data/lib/pry/testable/mockable.rb +2 -2
  108. data/lib/pry/testable/pry_tester.rb +1 -1
  109. data/lib/pry/testable/utility.rb +2 -2
  110. data/lib/pry/testable/variables.rb +1 -1
  111. data/lib/pry/version.rb +1 -1
  112. data/lib/pry/wrapped_module.rb +15 -15
  113. data/lib/pry/wrapped_module/candidate.rb +2 -2
  114. metadata +19 -31
  115. data/lib/pry/commands/list_prompts.rb +0 -35
  116. data/lib/pry/commands/simple_prompt.rb +0 -22
  117. data/lib/pry/history_array.rb +0 -121
  118. data/lib/pry/rbx_path.rb +0 -22
@@ -1,7 +1,6 @@
1
1
  class Pry
2
2
  class Command::Ls < Pry::ClassCommand
3
3
  class Globals < Pry::Command::Ls::Formatter
4
-
5
4
  # Taken from "puts global_variables.inspect".
6
5
  BUILTIN_GLOBALS =
7
6
  %w($" $$ $* $, $-0 $-F $-I $-K $-W $-a $-d $-i $-l $-p $-v $-w $. $/ $\\
@@ -42,7 +41,6 @@ class Pry
42
41
  end
43
42
  end
44
43
  end
45
-
46
44
  end
47
45
  end
48
46
  end
@@ -1,7 +1,6 @@
1
1
  class Pry
2
2
  class Command::Ls < Pry::ClassCommand
3
3
  class Grep
4
-
5
4
  def initialize(grep_regexp)
6
5
  @grep_regexp = grep_regexp
7
6
  end
@@ -15,7 +14,6 @@ class Pry
15
14
  end
16
15
  }
17
16
  end
18
-
19
17
  end
20
18
  end
21
19
  end
@@ -33,7 +33,6 @@ class Pry
33
33
  def format(type, vars)
34
34
  vars.sort_by { |var| var.to_s.downcase }.map { |var| color(type, var) }
35
35
  end
36
-
37
36
  end
38
37
  end
39
38
  end
@@ -1,7 +1,6 @@
1
1
  class Pry
2
2
  class Command::Ls < Pry::ClassCommand
3
3
  class LocalNames < Pry::Command::Ls::Formatter
4
-
5
4
  def initialize(no_user_opts, args, _pry_)
6
5
  super(_pry_)
7
6
  @no_user_opts = no_user_opts
@@ -29,7 +28,6 @@ class Pry
29
28
  end
30
29
  end
31
30
  end
32
-
33
31
  end
34
32
  end
35
33
  end
@@ -1,7 +1,6 @@
1
1
  class Pry
2
2
  class Command::Ls < Pry::ClassCommand
3
3
  class LocalVars < Pry::Command::Ls::Formatter
4
-
5
4
  def initialize(opts, _pry_)
6
5
  super(_pry_)
7
6
  @default_switch = opts[:locals]
@@ -33,7 +32,6 @@ class Pry
33
32
  pad = desired_width + color_escape_padding
34
33
  "%-#{pad}s = %s" % [color(:local_var, colorized_lhs), rhs]
35
34
  end
36
-
37
35
  end
38
36
  end
39
37
  end
@@ -10,7 +10,6 @@ require 'pry/commands/ls/local_vars'
10
10
 
11
11
  class Pry
12
12
  class Command::Ls < Pry::ClassCommand
13
-
14
13
  class LsEntity
15
14
  attr_reader :_pry_
16
15
 
@@ -4,7 +4,6 @@ require 'pry/commands/ls/interrogatable'
4
4
  class Pry
5
5
  class Command::Ls < Pry::ClassCommand
6
6
  class Methods < Pry::Command::Ls::Formatter
7
-
8
7
  include Pry::Command::Ls::Interrogatable
9
8
  include Pry::Command::Ls::MethodsHelper
10
9
 
@@ -37,7 +36,6 @@ class Pry
37
36
  super || @instance_methods_switch || @ppp_switch || @no_user_opts
38
37
  end
39
38
 
40
-
41
39
  # Get a lambda that can be used with `take_while` to prevent over-eager
42
40
  # traversal of the Object's ancestry graph.
43
41
  def below_ceiling
@@ -51,7 +49,6 @@ class Pry
51
49
  end
52
50
  lambda { |klass| !ceiling.include?(klass) }
53
51
  end
54
-
55
52
  end
56
53
  end
57
54
  end
@@ -14,7 +14,7 @@ module Pry::Command::Ls::MethodsHelper
14
14
  Pry::Method.all_from_obj(@interrogatee)
15
15
  end
16
16
 
17
- if Pry::Helpers::BaseHelpers.jruby? && !@jruby_switch
17
+ if Pry::Helpers::Platform.jruby? && !@jruby_switch
18
18
  methods = trim_jruby_aliases(methods)
19
19
  end
20
20
 
@@ -28,7 +28,6 @@ class Pry
28
28
  def correct_opts?
29
29
  @no_user_opts && interrogating_a_module?
30
30
  end
31
-
32
31
  end
33
32
  end
34
33
  end
@@ -31,7 +31,7 @@ class Pry
31
31
  ' "open". `amend-line` can then be used to' \
32
32
  ' modify the method.'
33
33
 
34
- opt.on :e, :expression=, 'Executes until end of valid expression', :as => Integer
34
+ opt.on :e, :expression=, 'Executes until end of valid expression', as: Integer
35
35
  opt.on :p, :print, 'Prints executed code'
36
36
  end
37
37
 
@@ -53,7 +53,6 @@ class Pry
53
53
  end
54
54
  end
55
55
 
56
-
57
56
  def content_after_options
58
57
  if opts.present?(:open)
59
58
  restrict_to_lines(content, (0..-2))
@@ -17,7 +17,7 @@ class Pry
17
17
  BANNER
18
18
 
19
19
  def process
20
- _pry_.pager.page text.bold('Backtrace:') << "\n--\n" << _pry_.backtrace.join("\n")
20
+ _pry_.pager.page bold('Backtrace:') << "\n--\n" << _pry_.backtrace.join("\n")
21
21
  end
22
22
  end
23
23
 
@@ -4,7 +4,7 @@ class Pry
4
4
  match(/raise-up(!?\b.*)/)
5
5
  group 'Context'
6
6
  description 'Raise an exception out of the current pry instance.'
7
- command_options :listing => 'raise-up'
7
+ command_options listing: 'raise-up'
8
8
 
9
9
  banner <<-BANNER
10
10
  Raise up, like exit, allows you to quit pry. Instead of returning a value
@@ -23,6 +23,7 @@ class Pry
23
23
 
24
24
  def process
25
25
  return _pry.pager.page help if captures[0] =~ /(-h|--help)\b/
26
+
26
27
  # Handle 'raise-up', 'raise-up "foo"', 'raise-up RuntimeError, 'farble' in a rubyesque manner
27
28
  target.eval("_pry_.raise_up#{captures[0]}")
28
29
  end
@@ -31,13 +31,14 @@ class Pry
31
31
  @pager = pager
32
32
  super opts
33
33
  end
34
+
34
35
  def page
35
36
  paging_text = StringIO.new
36
37
  yield paging_text
37
38
  @pager.page(paging_text.string)
38
39
  end
39
40
 
40
- def formatter(io)
41
+ def formatter(_io)
41
42
  if @formatter_klass
42
43
  @formatter_klass.new
43
44
  else
@@ -46,14 +47,14 @@ class Pry
46
47
  end
47
48
  end
48
49
 
49
- RDoc::RI.const_set :PryDriver, subclass # hook it up!
50
+ RDoc::RI.const_set :PryDriver, subclass # hook it up!
50
51
  end
51
52
 
52
53
  # Spin-up an RI insance.
53
- ri = RDoc::RI::PryDriver.new _pry_.pager, :use_stdout => true, :interactive => false
54
+ ri = RDoc::RI::PryDriver.new _pry_.pager, use_stdout: true, interactive: false
54
55
 
55
56
  begin
56
- ri.display_names [spec] # Get the documentation (finally!)
57
+ ri.display_names [spec] # Get the documentation (finally!)
57
58
  rescue RDoc::RI::Driver::NotFoundError => e
58
59
  output.puts "error: '#{e.name}' not found"
59
60
  end
@@ -3,8 +3,8 @@ class Pry
3
3
  match(/\.(.*)/)
4
4
  group 'Input and Output'
5
5
  description "All text following a '.' is forwarded to the shell."
6
- command_options :listing => '.<shell command>', :use_prefix => false,
7
- :takes_block => true
6
+ command_options listing: '.<shell command>', use_prefix: false,
7
+ takes_block: true
8
8
 
9
9
  banner <<-'BANNER'
10
10
  Usage: .COMMAND_NAME
@@ -33,6 +33,7 @@ class Pry
33
33
  def parse_destination(dest)
34
34
  return "~" if dest.empty?
35
35
  return dest unless dest == "-"
36
+
36
37
  state.old_pwd || raise(CommandError, "No prior directory available")
37
38
  end
38
39
 
@@ -9,13 +9,13 @@ class Pry
9
9
  BANNER
10
10
 
11
11
  def process
12
- case _pry_.prompt
13
- when Pry::SHELL_PROMPT
14
- _pry_.pop_prompt
15
- _pry_.custom_completions = _pry_.config.file_completions
12
+ state.disabled ^= true
13
+
14
+ if state.disabled
15
+ state.prev_prompt = _pry_.prompt
16
+ _pry_.prompt = Pry::Prompt[:shell][:value]
16
17
  else
17
- _pry_.push_prompt Pry::SHELL_PROMPT
18
- _pry_.custom_completions = _pry_.config.command_completions
18
+ _pry_.prompt = state.prev_prompt
19
19
  end
20
20
  end
21
21
  end
@@ -62,19 +62,17 @@ class Pry
62
62
  # Which sections to include in the 'header', can toggle: :owner,
63
63
  # :signature and visibility.
64
64
  def header_options
65
- super.merge :signature => true
65
+ super.merge signature: true
66
66
  end
67
67
 
68
68
  # figure out start line of docs by back-calculating based on
69
69
  # number of lines in the comment and the start line of the code_object
70
70
  # @return [Fixnum] start line of docs
71
71
  def start_line_for(code_object)
72
- if code_object.command? || opts.present?(:'base-one')
73
- 1
74
- else
75
- code_object.source_line.nil? ? 1 :
76
- (code_object.source_line - code_object.doc.lines.count)
77
- end
72
+ return 1 if code_object.command? || opts.present?(:'base-one')
73
+ return 1 unless code_object.source_line
74
+
75
+ code_object.source_line - code_object.doc.lines.count
78
76
  end
79
77
  end
80
78
 
@@ -2,7 +2,7 @@ class Pry
2
2
  class Command::ShowInfo < Pry::ClassCommand
3
3
  extend Pry::Helpers::BaseHelpers
4
4
 
5
- command_options :shellwords => false, :interpolate => false
5
+ command_options shellwords: false, interpolate: false
6
6
 
7
7
  def initialize(*)
8
8
  super
@@ -11,15 +11,16 @@ class Pry
11
11
  end
12
12
 
13
13
  def options(opt)
14
- opt.on :s, :super, "Select the 'super' method. Can be repeated to traverse the ancestors", :as => :count
14
+ opt.on :s, :super, "Select the 'super' method. Can be repeated to traverse the ancestors", as: :count
15
15
  opt.on :l, "line-numbers", "Show line numbers"
16
16
  opt.on :b, "base-one", "Show line numbers but start numbering at 1 (useful for `amend-line` and `play` commands)"
17
- opt.on :a, :all, "Show all definitions and monkeypatches of the module/class"
17
+ opt.on :a, :all, "Show all definitions and monkeypatches of the module/class"
18
18
  end
19
19
 
20
20
  def process
21
- code_object = Pry::CodeObject.lookup(obj_name, _pry_, :super => opts[:super])
21
+ code_object = Pry::CodeObject.lookup(obj_name, _pry_, super: opts[:super])
22
22
  raise CommandError, no_definition_message if !code_object
23
+
23
24
  @original_code_object = code_object
24
25
 
25
26
  if !obj_name && code_object.c_module? && !opts[:all]
@@ -80,7 +81,7 @@ class Pry
80
81
  mod.number_of_candidates.times do |v|
81
82
  candidate = mod.candidate(v)
82
83
  begin
83
- result << "\nCandidate #{v+1}/#{mod.number_of_candidates}: #{candidate.source_file} @ line #{candidate.source_line}:\n"
84
+ result << "\nCandidate #{v + 1}/#{mod.number_of_candidates}: #{candidate.source_file} @ line #{candidate.source_line}:\n"
84
85
  content = content_for(candidate)
85
86
 
86
87
  result << "Number of lines: #{content.lines.count}\n\n" << content
@@ -100,11 +101,17 @@ class Pry
100
101
  # object types: methods, modules, commands, procs...
101
102
  def header(code_object)
102
103
  file_name, line_num = file_and_line_for(code_object)
103
- h = "\n#{Pry::Helpers::Text.bold('From:')} #{file_name} "
104
+ content = content_for(code_object)
105
+
106
+ h = "\n#{bold('From:')} #{file_name} "
104
107
  h << code_object_header(code_object, line_num)
105
- h << "\n#{Pry::Helpers::Text.bold('Number of lines:')} " <<
106
- "#{content_for(code_object).lines.count}\n\n"
107
- h << Helpers::Text.bold('** Warning:') << " Cannot find code for #{@original_code_object.nonblank_name}. Showing superclass #{code_object.nonblank_name} instead. **\n\n" if @used_super
108
+ h << "\n#{bold('Number of lines:')} " << "#{content.lines.count}\n\n"
109
+ h << bold('** Warning:') << " Cannot find code for #{@original_code_object.nonblank_name}. Showing superclass #{code_object.nonblank_name} instead. **\n\n" if @used_super
110
+
111
+ if content.lines.none?
112
+ h << bold('** Warning:') << " Cannot find code for '#{code_object.name}' (source_location is nil)"
113
+ end
114
+
108
115
  h
109
116
  end
110
117
 
@@ -133,11 +140,11 @@ class Pry
133
140
  def module_header(code_object, line_num)
134
141
  h = ""
135
142
  h << "@ line #{line_num}:\n"
136
- h << text.bold(code_object.module? ? "Module" : "Class")
137
- h << " #{text.bold('name:')} #{code_object.nonblank_name}"
143
+ h << bold(code_object.module? ? "Module" : "Class")
144
+ h << " #{bold('name:')} #{code_object.nonblank_name}"
138
145
 
139
146
  if code_object.number_of_candidates > 1
140
- h << (text.bold("\nNumber of monkeypatches: ") << code_object.number_of_candidates.to_s)
147
+ h << (bold("\nNumber of monkeypatches: ") << code_object.number_of_candidates.to_s)
141
148
  h << ". Use the `-a` option to display all available monkeypatches"
142
149
  end
143
150
  h
@@ -145,17 +152,17 @@ class Pry
145
152
 
146
153
  def method_sections(code_object)
147
154
  {
148
- :owner => "\n#{text.bold("Owner:")} #{code_object.owner || "N/A"}\n",
149
- :visibility => "#{text.bold("Visibility:")} #{code_object.visibility}",
150
- :signature => "\n#{text.bold("Signature:")} #{code_object.signature}"
155
+ owner: "\n#{bold("Owner:")} #{code_object.owner || "N/A"}\n",
156
+ visibility: "#{bold("Visibility:")} #{code_object.visibility}",
157
+ signature: "\n#{bold("Signature:")} #{code_object.signature}"
151
158
  }.merge(header_options) { |key, old, new| (new && old).to_s }
152
159
  end
153
160
 
154
161
  def header_options
155
162
  {
156
- :owner => true,
157
- :visibility => true,
158
- :signature => nil
163
+ owner: true,
164
+ visibility: true,
165
+ signature: nil
159
166
  }
160
167
  end
161
168
 
@@ -39,8 +39,11 @@ class Pry
39
39
 
40
40
  # The source for code_object prepared for display.
41
41
  def content_for(code_object)
42
- Code.new(code_object.source, start_line_for(code_object)).
43
- with_line_numbers(use_line_numbers?).highlighted
42
+ code = Code.new(
43
+ code_object.source || [],
44
+ start_line_for(code_object)
45
+ )
46
+ code.with_line_numbers(use_line_numbers?).highlighted
44
47
  end
45
48
  end
46
49
 
@@ -3,7 +3,7 @@ class Pry
3
3
  match 'stat'
4
4
  group 'Introspection'
5
5
  description 'View method information and set _file_ and _dir_ locals.'
6
- command_options :shellwords => false
6
+ command_options shellwords: false
7
7
 
8
8
  banner <<-'BANNER'
9
9
  Usage: stat [OPTIONS] [METH]
@@ -5,7 +5,7 @@ class Pry
5
5
  match 'watch'
6
6
  group 'Context'
7
7
  description 'Watch the value of an expression and print a notification whenever it changes.'
8
- command_options :use_prefix => false
8
+ command_options use_prefix: false
9
9
 
10
10
  banner <<-'BANNER'
11
11
  Usage: watch [EXPRESSION]
@@ -29,7 +29,7 @@ class Pry
29
29
  def options(opt)
30
30
  opt.on :d, :delete,
31
31
  "Delete the watch expression with the given index. If no index is given; clear all watch expressions.",
32
- :optional_argument => true, :as => Integer
32
+ optional_argument: true, as: Integer
33
33
  opt.on :l, :list,
34
34
  "Show all current watch expressions and their values. Calling watch with no expressions or options will also show the watch expressions."
35
35
  end
@@ -54,8 +54,8 @@ class Pry
54
54
 
55
55
  def delete(index)
56
56
  if index
57
- output.puts "Deleting watch expression ##{index}: #{expressions[index-1]}"
58
- expressions.delete_at(index-1)
57
+ output.puts "Deleting watch expression ##{index}: #{expressions[index - 1]}"
58
+ expressions.delete_at(index - 1)
59
59
  else
60
60
  output.puts "Deleting all watched expressions"
61
61
  expressions.clear
@@ -70,7 +70,7 @@ class Pry
70
70
  pager.puts "Listing all watched expressions:"
71
71
  pager.puts ""
72
72
  expressions.each_with_index do |expr, index|
73
- pager.print text.with_line_numbers(expr.to_s, index+1)
73
+ pager.print with_line_numbers(expr.to_s, index + 1)
74
74
  end
75
75
  pager.puts ""
76
76
  end
@@ -81,12 +81,14 @@ class Pry
81
81
  expressions.each do |expr|
82
82
  expr.eval!
83
83
  if expr.changed?
84
- output.puts "#{text.blue "watch"}: #{expr.to_s}"
84
+ output.puts "#{blue "watch"}: #{expr}"
85
85
  end
86
86
  end
87
87
  end
88
88
 
89
- def add_expression(arguments)
89
+ # TODO: fix arguments.
90
+ # https://github.com/pry/pry/commit/b031df2f2f5850ee6e9018f33d35f3485a9b0423
91
+ def add_expression(_arguments)
90
92
  expressions << Expression.new(_pry_, target, arg_string)
91
93
  output.puts "Watching #{Code.new(arg_string).highlighted}"
92
94
  end
@@ -1,6 +1,5 @@
1
1
  class Pry
2
2
  class Command::Whereami < Pry::ClassCommand
3
-
4
3
  def initialize(*)
5
4
  super
6
5
 
@@ -94,7 +93,7 @@ class Pry
94
93
 
95
94
  set_file_and_dir_locals(@file)
96
95
 
97
- out = "\n#{text.bold('From:')} #{location}:\n\n" <<
96
+ out = "\n#{bold('From:')} #{location}:\n\n" <<
98
97
  code.with_line_numbers(use_line_numbers?).with_marker(marker).highlighted << "\n"
99
98
 
100
99
  _pry_.pager.page out
@@ -154,8 +153,9 @@ class Pry
154
153
  # or it returns the class of `target_self` if `target_self` is not a class.
155
154
  # @return [Pry::WrappedModule]
156
155
  def target_class
157
- target_self.is_a?(Module) ? Pry::WrappedModule(target_self) :
158
- Pry::WrappedModule(target_self.class)
156
+ return Pry::WrappedModule(target_self) if target_self.is_a?(Module)
157
+
158
+ Pry::WrappedModule(target_self.class)
159
159
  end
160
160
 
161
161
  def class_code