pry 0.12.2-java → 0.13.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +110 -1
  3. data/LICENSE +1 -1
  4. data/README.md +331 -269
  5. data/bin/pry +5 -0
  6. data/lib/pry.rb +133 -119
  7. data/lib/pry/basic_object.rb +8 -4
  8. data/lib/pry/block_command.rb +22 -0
  9. data/lib/pry/class_command.rb +194 -0
  10. data/lib/pry/cli.rb +40 -31
  11. data/lib/pry/code.rb +39 -27
  12. data/lib/pry/code/code_file.rb +28 -24
  13. data/lib/pry/code/code_range.rb +4 -2
  14. data/lib/pry/code/loc.rb +15 -8
  15. data/lib/pry/code_object.rb +40 -38
  16. data/lib/pry/color_printer.rb +47 -46
  17. data/lib/pry/command.rb +166 -369
  18. data/lib/pry/command_set.rb +76 -73
  19. data/lib/pry/command_state.rb +31 -0
  20. data/lib/pry/commands/amend_line.rb +86 -81
  21. data/lib/pry/commands/bang.rb +18 -14
  22. data/lib/pry/commands/bang_pry.rb +15 -11
  23. data/lib/pry/commands/cat.rb +61 -54
  24. data/lib/pry/commands/cat/abstract_formatter.rb +23 -18
  25. data/lib/pry/commands/cat/exception_formatter.rb +71 -60
  26. data/lib/pry/commands/cat/file_formatter.rb +55 -49
  27. data/lib/pry/commands/cat/input_expression_formatter.rb +35 -30
  28. data/lib/pry/commands/cd.rb +40 -35
  29. data/lib/pry/commands/change_inspector.rb +29 -22
  30. data/lib/pry/commands/change_prompt.rb +44 -39
  31. data/lib/pry/commands/clear_screen.rb +16 -10
  32. data/lib/pry/commands/code_collector.rb +148 -133
  33. data/lib/pry/commands/disable_pry.rb +23 -19
  34. data/lib/pry/commands/easter_eggs.rb +19 -30
  35. data/lib/pry/commands/edit.rb +184 -161
  36. data/lib/pry/commands/edit/exception_patcher.rb +21 -17
  37. data/lib/pry/commands/edit/file_and_line_locator.rb +34 -23
  38. data/lib/pry/commands/exit.rb +39 -35
  39. data/lib/pry/commands/exit_all.rb +24 -20
  40. data/lib/pry/commands/exit_program.rb +20 -16
  41. data/lib/pry/commands/find_method.rb +168 -160
  42. data/lib/pry/commands/fix_indent.rb +16 -12
  43. data/lib/pry/commands/help.rb +140 -133
  44. data/lib/pry/commands/hist.rb +151 -150
  45. data/lib/pry/commands/import_set.rb +20 -16
  46. data/lib/pry/commands/jump_to.rb +25 -21
  47. data/lib/pry/commands/list_inspectors.rb +35 -28
  48. data/lib/pry/commands/ls.rb +124 -102
  49. data/lib/pry/commands/ls/constants.rb +59 -42
  50. data/lib/pry/commands/ls/formatter.rb +50 -46
  51. data/lib/pry/commands/ls/globals.rb +38 -34
  52. data/lib/pry/commands/ls/grep.rb +17 -13
  53. data/lib/pry/commands/ls/instance_vars.rb +29 -27
  54. data/lib/pry/commands/ls/interrogatable.rb +18 -12
  55. data/lib/pry/commands/ls/jruby_hacks.rb +47 -41
  56. data/lib/pry/commands/ls/local_names.rb +26 -22
  57. data/lib/pry/commands/ls/local_vars.rb +38 -28
  58. data/lib/pry/commands/ls/ls_entity.rb +47 -51
  59. data/lib/pry/commands/ls/methods.rb +44 -43
  60. data/lib/pry/commands/ls/methods_helper.rb +46 -42
  61. data/lib/pry/commands/ls/self_methods.rb +23 -22
  62. data/lib/pry/commands/nesting.rb +21 -17
  63. data/lib/pry/commands/play.rb +93 -82
  64. data/lib/pry/commands/pry_backtrace.rb +24 -17
  65. data/lib/pry/commands/pry_version.rb +15 -11
  66. data/lib/pry/commands/raise_up.rb +27 -22
  67. data/lib/pry/commands/reload_code.rb +60 -48
  68. data/lib/pry/commands/reset.rb +16 -12
  69. data/lib/pry/commands/ri.rb +55 -45
  70. data/lib/pry/commands/save_file.rb +45 -43
  71. data/lib/pry/commands/shell_command.rb +51 -51
  72. data/lib/pry/commands/shell_mode.rb +21 -17
  73. data/lib/pry/commands/show_doc.rb +81 -68
  74. data/lib/pry/commands/show_info.rb +189 -171
  75. data/lib/pry/commands/show_input.rb +16 -11
  76. data/lib/pry/commands/show_source.rb +109 -45
  77. data/lib/pry/commands/stat.rb +35 -31
  78. data/lib/pry/commands/switch_to.rb +21 -15
  79. data/lib/pry/commands/toggle_color.rb +20 -16
  80. data/lib/pry/commands/watch_expression.rb +89 -86
  81. data/lib/pry/commands/watch_expression/expression.rb +32 -27
  82. data/lib/pry/commands/whereami.rb +156 -148
  83. data/lib/pry/commands/wtf.rb +75 -50
  84. data/lib/pry/config.rb +311 -25
  85. data/lib/pry/config/attributable.rb +22 -0
  86. data/lib/pry/config/lazy_value.rb +29 -0
  87. data/lib/pry/config/memoized_value.rb +34 -0
  88. data/lib/pry/config/value.rb +24 -0
  89. data/lib/pry/control_d_handler.rb +28 -0
  90. data/lib/pry/core_extensions.rb +9 -7
  91. data/lib/pry/editor.rb +48 -21
  92. data/lib/pry/env.rb +18 -0
  93. data/lib/pry/exception_handler.rb +43 -0
  94. data/lib/pry/exceptions.rb +13 -16
  95. data/lib/pry/forwardable.rb +5 -1
  96. data/lib/pry/helpers.rb +2 -0
  97. data/lib/pry/helpers/base_helpers.rb +68 -197
  98. data/lib/pry/helpers/command_helpers.rb +50 -61
  99. data/lib/pry/helpers/documentation_helpers.rb +20 -13
  100. data/lib/pry/helpers/options_helpers.rb +14 -7
  101. data/lib/pry/helpers/platform.rb +7 -5
  102. data/lib/pry/helpers/table.rb +33 -26
  103. data/lib/pry/helpers/text.rb +17 -14
  104. data/lib/pry/history.rb +48 -56
  105. data/lib/pry/hooks.rb +21 -12
  106. data/lib/pry/indent.rb +54 -50
  107. data/lib/pry/input_completer.rb +248 -230
  108. data/lib/pry/input_lock.rb +8 -9
  109. data/lib/pry/inspector.rb +36 -24
  110. data/lib/pry/last_exception.rb +45 -45
  111. data/lib/pry/method.rb +141 -94
  112. data/lib/pry/method/disowned.rb +16 -4
  113. data/lib/pry/method/patcher.rb +12 -3
  114. data/lib/pry/method/weird_method_locator.rb +68 -44
  115. data/lib/pry/object_path.rb +33 -25
  116. data/lib/pry/output.rb +121 -35
  117. data/lib/pry/pager.rb +41 -42
  118. data/lib/pry/plugins.rb +25 -8
  119. data/lib/pry/prompt.rb +123 -54
  120. data/lib/pry/pry_class.rb +61 -98
  121. data/lib/pry/pry_instance.rb +217 -215
  122. data/lib/pry/repl.rb +18 -22
  123. data/lib/pry/repl_file_loader.rb +27 -21
  124. data/lib/pry/ring.rb +11 -6
  125. data/lib/pry/slop.rb +574 -563
  126. data/lib/pry/slop/commands.rb +164 -169
  127. data/lib/pry/slop/option.rb +172 -168
  128. data/lib/pry/syntax_highlighter.rb +26 -0
  129. data/lib/pry/system_command_handler.rb +17 -0
  130. data/lib/pry/testable.rb +59 -61
  131. data/lib/pry/testable/evalable.rb +21 -12
  132. data/lib/pry/testable/mockable.rb +18 -10
  133. data/lib/pry/testable/pry_tester.rb +71 -56
  134. data/lib/pry/testable/utility.rb +29 -21
  135. data/lib/pry/testable/variables.rb +49 -43
  136. data/lib/pry/version.rb +3 -1
  137. data/lib/pry/warning.rb +27 -0
  138. data/lib/pry/wrapped_module.rb +51 -42
  139. data/lib/pry/wrapped_module/candidate.rb +21 -14
  140. metadata +31 -30
  141. data/lib/pry/commands.rb +0 -6
  142. data/lib/pry/commands/disabled_commands.rb +0 -2
  143. data/lib/pry/commands/gem_cd.rb +0 -26
  144. data/lib/pry/commands/gem_install.rb +0 -32
  145. data/lib/pry/commands/gem_list.rb +0 -33
  146. data/lib/pry/commands/gem_open.rb +0 -29
  147. data/lib/pry/commands/gem_readme.rb +0 -25
  148. data/lib/pry/commands/gem_search.rb +0 -40
  149. data/lib/pry/commands/gem_stats.rb +0 -83
  150. data/lib/pry/commands/gist.rb +0 -102
  151. data/lib/pry/commands/install_command.rb +0 -54
  152. data/lib/pry/config/behavior.rb +0 -255
  153. data/lib/pry/config/convenience.rb +0 -28
  154. data/lib/pry/config/default.rb +0 -159
  155. data/lib/pry/config/memoization.rb +0 -48
  156. data/lib/pry/platform.rb +0 -91
  157. data/lib/pry/rubygem.rb +0 -84
  158. data/lib/pry/terminal.rb +0 -91
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Pry
4
+ class Config
5
+ # Attributable provides the ability to create "attribute"
6
+ # accessors. Attribute accessors create a standard "attr_writer" and a
7
+ # customised "attr_reader". This reader is Proc-aware (lazy).
8
+ #
9
+ # @since v0.13.0
10
+ # @api private
11
+ module Attributable
12
+ def attribute(attr_name)
13
+ define_method(attr_name) do
14
+ value = Config::Value.new(instance_variable_get("@#{attr_name}"))
15
+ value.call
16
+ end
17
+
18
+ attr_writer(attr_name)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Pry
4
+ class Config
5
+ # LazyValue is a Proc (block) wrapper. It is meant to be used as a
6
+ # configuration value. Subsequent `#call` calls always evaluate the given
7
+ # block.
8
+ #
9
+ # @example
10
+ # num = 19
11
+ # value = Pry::Config::LazyValue.new { num += 1 }
12
+ # value.foo # => 20
13
+ # value.foo # => 21
14
+ # value.foo # => 22
15
+ #
16
+ # @api private
17
+ # @since v0.13.0
18
+ # @see Pry::Config::MemoizedValue
19
+ class LazyValue
20
+ def initialize(&block)
21
+ @block = block
22
+ end
23
+
24
+ def call
25
+ @block.call
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Pry
4
+ class Config
5
+ # MemoizedValue is a Proc (block) wrapper. It is meant to be used as a
6
+ # configuration value. Subsequent `#call` calls return the same memoized
7
+ # result.
8
+ #
9
+ # @example
10
+ # num = 19
11
+ # value = Pry::Config::MemoizedValue.new { num += 1 }
12
+ # value.call # => 20
13
+ # value.call # => 20
14
+ # value.call # => 20
15
+ #
16
+ # @api private
17
+ # @since v0.13.0
18
+ # @see Pry::Config::LazyValue
19
+ class MemoizedValue
20
+ def initialize(&block)
21
+ @block = block
22
+ @called = false
23
+ @call = nil
24
+ end
25
+
26
+ def call
27
+ return @call if @called
28
+
29
+ @called = true
30
+ @call = @block.call
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Pry
4
+ class Config
5
+ # Value holds a value for the given attribute and decides how it should
6
+ # be read. Procs get called, other values are returned as is.
7
+ #
8
+ # @since v0.13.0
9
+ # @api private
10
+ class Value
11
+ def initialize(value)
12
+ @value = value
13
+ end
14
+
15
+ def call
16
+ unless [Config::MemoizedValue, Config::LazyValue].include?(@value.class)
17
+ return @value
18
+ end
19
+
20
+ @value.call
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Pry
4
+ # @api private
5
+ # @since v0.13.0
6
+ module ControlDHandler
7
+ # Deal with the ^D key being pressed. Different behaviour in different
8
+ # cases:
9
+ # 1. In an expression behave like `!` command.
10
+ # 2. At top-level session behave like `exit` command.
11
+ # 3. In a nested session behave like `cd ..`.
12
+ def self.default(pry_instance)
13
+ if !pry_instance.eval_string.empty?
14
+ # Clear input buffer.
15
+ pry_instance.eval_string = ''
16
+ elsif pry_instance.binding_stack.one?
17
+ pry_instance.binding_stack.clear
18
+ throw(:breakout)
19
+ else
20
+ # Otherwise, saves current binding stack as old stack and pops last
21
+ # binding out of binding stack (the old stack still has that binding).
22
+ cd_state = Pry::CommandState.default.state_for('cd')
23
+ cd_state.old_stack = pry_instance.binding_stack.dup
24
+ pry_instance.binding_stack.pop
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Pry
2
4
  # @return [Array] Code of the method used when implementing Pry's
3
5
  # __binding__, along with line indication to be used with instance_eval (and
4
6
  # friends).
5
7
  #
6
8
  # @see Object#__binding__
7
- BINDING_METHOD_IMPL = [<<-METHOD, __FILE__, __LINE__ + 1]
9
+ BINDING_METHOD_IMPL = [<<-METHOD, __FILE__, __LINE__ + 1].freeze
8
10
  # Get a binding with 'self' set to self, and no locals.
9
11
  #
10
12
  # The default definee is determined by the context in which the
@@ -39,7 +41,7 @@ class Object
39
41
  # my_method()
40
42
  # @see Pry.start
41
43
  def pry(object = nil, hash = {})
42
- if object.nil? || Hash === object
44
+ if object.nil? || Hash === object # rubocop:disable Style/CaseEquality
43
45
  Pry.start(self, object || {})
44
46
  else
45
47
  Pry.start(object, hash)
@@ -81,10 +83,10 @@ class Object
81
83
  # This fixes the following two spec failures, at https://travis-ci.org/pry/pry/jobs/274470002
82
84
  # 1) ./spec/pry_spec.rb:360:in `block in (root)'
83
85
  # 2) ./spec/pry_spec.rb:366:in `block in (root)'
84
- return class_eval { binding } if Pry::Helpers::Platform.jruby? and self.name == nil
86
+ return class_eval { binding } if Pry::Helpers::Platform.jruby? && name.nil?
85
87
 
86
88
  # class_eval sets both self and the default definee to this class.
87
- return class_eval("binding")
89
+ return class_eval("binding", __FILE__, __LINE__)
88
90
  end
89
91
 
90
92
  unless self.class.method_defined?(:__pry__)
@@ -124,7 +126,7 @@ class BasicObject
124
126
  # BasicObjects don't have respond_to?, so we just define the method
125
127
  # every time. As they also don't have `.freeze`, this call won't
126
128
  # fail as it can for normal Objects.
127
- (class << self; self; end).class_eval <<-EOF, __FILE__, __LINE__ + 1
129
+ (class << self; self; end).class_eval(<<-METHOD, __FILE__, __LINE__ + 1)
128
130
  # Get a binding with 'self' set to self, and no locals.
129
131
  #
130
132
  # The default definee is determined by the context in which the
@@ -136,7 +138,7 @@ class BasicObject
136
138
  def __pry__
137
139
  ::Kernel.binding
138
140
  end
139
- EOF
140
- self.__pry__
141
+ METHOD
142
+ __pry__
141
143
  end
142
144
  end
@@ -1,11 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'shellwords'
4
+
1
5
  class Pry
2
6
  class Editor
7
+ def self.default
8
+ if (visual = Pry::Env['VISUAL'])
9
+ return visual
10
+ end
11
+
12
+ if (editor = Pry::Env['EDITOR'])
13
+ return editor
14
+ end
15
+
16
+ return 'notepad' if Helpers::Platform.windows?
17
+
18
+ %w[editor nano vi].find do |editor_exe|
19
+ Kernel.system("which #{editor_exe} > /dev/null 2>&1")
20
+ end
21
+ end
22
+
3
23
  include Pry::Helpers::CommandHelpers
4
24
 
5
- attr_reader :_pry_
25
+ attr_reader :pry_instance
6
26
 
7
- def initialize(_pry_)
8
- @_pry_ = _pry_
27
+ def initialize(pry_instance)
28
+ @pry_instance = pry_instance
9
29
  end
10
30
 
11
31
  def edit_tempfile_with_content(initial_content, line = 1)
@@ -19,7 +39,10 @@ class Pry
19
39
  end
20
40
 
21
41
  def invoke_editor(file, line, blocking = true)
22
- raise CommandError, "Please set Pry.config.editor or export $VISUAL or $EDITOR" unless _pry_.config.editor
42
+ unless pry_instance.config.editor
43
+ raise CommandError,
44
+ "Please set Pry.config.editor or export $VISUAL or $EDITOR"
45
+ end
23
46
 
24
47
  editor_invocation = build_editor_invocation_string(file, line, blocking)
25
48
  return nil unless editor_invocation
@@ -31,40 +54,44 @@ class Pry
31
54
  end
32
55
  end
33
56
 
34
- private
35
-
36
57
  # Generate the string that's used to start the editor. This includes
37
58
  # all the flags we want as well as the file and line number we
38
59
  # want to open at.
39
60
  def build_editor_invocation_string(file, line, blocking)
40
-
41
- if _pry_.config.editor.respond_to?(:call)
42
- args = [file, line, blocking][0...(_pry_.config.editor.arity)]
43
- _pry_.config.editor.call(*args)
61
+ if pry_instance.config.editor.respond_to?(:call)
62
+ args = [file, line, blocking][0...(pry_instance.config.editor.arity)]
63
+ pry_instance.config.editor.call(*args)
44
64
  else
45
65
  sanitized_file = Helpers::Platform.windows? ? file : Shellwords.escape(file)
46
- "#{_pry_.config.editor} #{blocking_flag_for_editor(blocking)} #{start_line_syntax_for_editor(sanitized_file, line)}"
66
+ editor = pry_instance.config.editor
67
+ flag = blocking_flag_for_editor(blocking)
68
+ start_line = start_line_syntax_for_editor(sanitized_file, line)
69
+ "#{editor} #{flag} #{start_line}"
47
70
  end
48
71
  end
49
72
 
73
+ private
74
+
50
75
  # Start the editor running, using the calculated invocation string
51
76
  def open_editor(editor_invocation)
52
77
  # Note we dont want to use Pry.config.system here as that
53
78
  # may be invoked non-interactively (i.e via Open4), whereas we want to
54
79
  # ensure the editor is always interactive
55
- system(*Shellwords.split(editor_invocation)) or raise CommandError, "`#{editor_invocation}` gave exit status: #{$?.exitstatus}"
80
+ system(*Shellwords.split(editor_invocation)) ||
81
+ raise(
82
+ CommandError,
83
+ "`#{editor_invocation}` gave exit status: #{$CHILD_STATUS.exitstatus}"
84
+ )
56
85
  end
57
86
 
58
87
  # We need JRuby specific code here cos just shelling out using
59
88
  # system() appears to be pretty broken :/
60
89
  def open_editor_on_jruby(editor_invocation)
61
- begin
62
- require 'spoon'
63
- pid = Spoon.spawnp(*Shellwords.split(editor_invocation))
64
- Process.waitpid(pid)
65
- rescue FFI::NotFoundError
66
- system(editor_invocation)
67
- end
90
+ require 'spoon'
91
+ pid = Spoon.spawnp(*Shellwords.split(editor_invocation))
92
+ Process.waitpid(pid)
93
+ rescue FFI::NotFoundError
94
+ system(editor_invocation)
68
95
  end
69
96
 
70
97
  # Some editors that run outside the terminal allow you to control whether or
@@ -104,7 +131,7 @@ class Pry
104
131
  "-l#{line_number} #{file_name}"
105
132
  else
106
133
  if Helpers::Platform.windows?
107
- "#{file_name}"
134
+ file_name.to_s
108
135
  else
109
136
  "+#{line_number} #{file_name}"
110
137
  end
@@ -122,7 +149,7 @@ class Pry
122
149
  # # => textmate
123
150
  #
124
151
  def editor_name
125
- File.basename(_pry_.config.editor).split(" ").first
152
+ File.basename(pry_instance.config.editor).split(" ").first
126
153
  end
127
154
  end
128
155
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Pry
4
+ # Env is a helper module to work with environment variables.
5
+ #
6
+ # @since v0.13.0
7
+ # @api private
8
+ module Env
9
+ def self.[](key)
10
+ return unless ENV.key?(key)
11
+
12
+ value = ENV[key]
13
+ return if value == ''
14
+
15
+ value
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Pry
4
+ # @api private
5
+ # @since v0.13.0
6
+ module ExceptionHandler
7
+ class << self
8
+ # Will only show the first line of the backtrace.
9
+ def handle_exception(output, exception, _pry_instance)
10
+ if exception.is_a?(UserError) && exception.is_a?(SyntaxError)
11
+ output.puts "SyntaxError: #{exception.message.sub(/.*syntax error, */m, '')}"
12
+ else
13
+ output.puts standard_error_text_for(exception)
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def standard_error_text_for(exception)
20
+ text = exception_text(exception)
21
+ return text unless exception.respond_to?(:cause)
22
+
23
+ cause = exception.cause
24
+ while cause
25
+ text += cause_text(cause)
26
+ cause = cause.cause
27
+ end
28
+
29
+ text
30
+ end
31
+
32
+ def exception_text(exception)
33
+ "#{exception.class}: #{exception.message}\n" \
34
+ "from #{exception.backtrace.first}\n"
35
+ end
36
+
37
+ def cause_text(cause)
38
+ "Caused by #{cause.class}: #{cause}\n" \
39
+ "from #{cause.backtrace.first}\n"
40
+ end
41
+ end
42
+ end
43
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Pry
2
4
  # As a REPL, we often want to catch any unexpected exceptions that may have
3
5
  # been raised; however we don't want to go overboard and prevent the user
@@ -13,7 +15,7 @@ class Pry
13
15
  # Don't catch signals (particularly not SIGTERM) as these are unlikely
14
16
  # to be intended for pry itself. We should also make sure that
15
17
  # Kernel#exit works.
16
- when *Pry.config.exception_whitelist
18
+ when *Pry.config.unrescued_exceptions
17
19
  false
18
20
  # All other exceptions will be caught.
19
21
  else
@@ -23,9 +25,13 @@ class Pry
23
25
  end
24
26
 
25
27
  # Catches SecurityErrors if $SAFE is set
26
- module Pry::TooSafeException
28
+ module TooSafeException
27
29
  def self.===(exception)
28
- $SAFE > 0 && SecurityError === exception
30
+ if Pry::HAS_SAFE_LEVEL
31
+ $SAFE > 0 && exception.is_a?(SecurityError)
32
+ else
33
+ exception.is_a?(SecurityError)
34
+ end
29
35
  end
30
36
  end
31
37
 
@@ -49,18 +55,14 @@ class Pry
49
55
  # the exception is just a vanilla RuntimeError.
50
56
  module FrozenObjectException
51
57
  def self.===(exception)
52
- ["can't modify frozen class/module",
53
- "can't modify frozen Class",
54
- "can't modify frozen object",
58
+ [
59
+ "can't modify frozen class/module",
60
+ "can't modify frozen Class",
61
+ "can't modify frozen object"
55
62
  ].include?(exception.message)
56
63
  end
57
64
  end
58
65
 
59
- # Don't catch these exceptions
60
- DEFAULT_EXCEPTION_WHITELIST = [SystemExit,
61
- SignalException,
62
- Pry::TooSafeException]
63
-
64
66
  # CommandErrors are caught by the REPL loop and displayed to the user. They
65
67
  # indicate an exceptional condition that's fatal to the current command.
66
68
  class CommandError < StandardError; end
@@ -68,9 +70,4 @@ class Pry
68
70
 
69
71
  # indicates obsolete API
70
72
  class ObsoleteError < StandardError; end
71
-
72
- # This is to keep from breaking under Rails 3.2 for people who are doing that
73
- # IRB = Pry thing.
74
- module ExtendCommandBundle
75
- end
76
73
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Pry
2
4
  module Forwardable
3
5
  require 'forwardable'
@@ -17,7 +19,9 @@ class Pry
17
19
  instance_variable_get(target).__send__(private_delegate, *a, &b)
18
20
  end
19
21
  end
20
- class_eval { private(*private_delegates) }
22
+ class_eval do
23
+ private(*private_delegates) # rubocop:disable Style/AccessModifierDeclarations
24
+ end
21
25
  end
22
26
  end
23
27
  end