super-smart-mod 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. checksums.yaml +7 -0
  2. data/pry-0.16.0/CHANGELOG.md +1211 -0
  3. data/pry-0.16.0/LICENSE +25 -0
  4. data/pry-0.16.0/README.md +469 -0
  5. data/pry-0.16.0/bin/pry +13 -0
  6. data/pry-0.16.0/lib/pry/basic_object.rb +10 -0
  7. data/pry-0.16.0/lib/pry/block_command.rb +22 -0
  8. data/pry-0.16.0/lib/pry/class_command.rb +194 -0
  9. data/pry-0.16.0/lib/pry/cli.rb +211 -0
  10. data/pry-0.16.0/lib/pry/code/code_file.rb +114 -0
  11. data/pry-0.16.0/lib/pry/code/code_range.rb +73 -0
  12. data/pry-0.16.0/lib/pry/code/loc.rb +105 -0
  13. data/pry-0.16.0/lib/pry/code.rb +357 -0
  14. data/pry-0.16.0/lib/pry/code_object.rb +197 -0
  15. data/pry-0.16.0/lib/pry/color_printer.rb +66 -0
  16. data/pry-0.16.0/lib/pry/command.rb +520 -0
  17. data/pry-0.16.0/lib/pry/command_set.rb +418 -0
  18. data/pry-0.16.0/lib/pry/command_state.rb +36 -0
  19. data/pry-0.16.0/lib/pry/commands/amend_line.rb +103 -0
  20. data/pry-0.16.0/lib/pry/commands/bang.rb +24 -0
  21. data/pry-0.16.0/lib/pry/commands/bang_pry.rb +21 -0
  22. data/pry-0.16.0/lib/pry/commands/cat/abstract_formatter.rb +32 -0
  23. data/pry-0.16.0/lib/pry/commands/cat/exception_formatter.rb +90 -0
  24. data/pry-0.16.0/lib/pry/commands/cat/file_formatter.rb +77 -0
  25. data/pry-0.16.0/lib/pry/commands/cat/input_expression_formatter.rb +48 -0
  26. data/pry-0.16.0/lib/pry/commands/cat.rb +70 -0
  27. data/pry-0.16.0/lib/pry/commands/cd.rb +48 -0
  28. data/pry-0.16.0/lib/pry/commands/change_inspector.rb +34 -0
  29. data/pry-0.16.0/lib/pry/commands/change_prompt.rb +51 -0
  30. data/pry-0.16.0/lib/pry/commands/clear_screen.rb +20 -0
  31. data/pry-0.16.0/lib/pry/commands/code_collector.rb +182 -0
  32. data/pry-0.16.0/lib/pry/commands/disable_pry.rb +31 -0
  33. data/pry-0.16.0/lib/pry/commands/easter_eggs.rb +101 -0
  34. data/pry-0.16.0/lib/pry/commands/edit/exception_patcher.rb +29 -0
  35. data/pry-0.16.0/lib/pry/commands/edit/file_and_line_locator.rb +47 -0
  36. data/pry-0.16.0/lib/pry/commands/edit.rb +225 -0
  37. data/pry-0.16.0/lib/pry/commands/exit.rb +47 -0
  38. data/pry-0.16.0/lib/pry/commands/exit_all.rb +33 -0
  39. data/pry-0.16.0/lib/pry/commands/exit_program.rb +27 -0
  40. data/pry-0.16.0/lib/pry/commands/find_method.rb +199 -0
  41. data/pry-0.16.0/lib/pry/commands/fix_indent.rb +23 -0
  42. data/pry-0.16.0/lib/pry/commands/help.rb +171 -0
  43. data/pry-0.16.0/lib/pry/commands/hist.rb +182 -0
  44. data/pry-0.16.0/lib/pry/commands/import_set.rb +27 -0
  45. data/pry-0.16.0/lib/pry/commands/jump_to.rb +33 -0
  46. data/pry-0.16.0/lib/pry/commands/list_inspectors.rb +42 -0
  47. data/pry-0.16.0/lib/pry/commands/ls/config.rb +54 -0
  48. data/pry-0.16.0/lib/pry/commands/ls/constants.rb +75 -0
  49. data/pry-0.16.0/lib/pry/commands/ls/formatter.rb +55 -0
  50. data/pry-0.16.0/lib/pry/commands/ls/globals.rb +50 -0
  51. data/pry-0.16.0/lib/pry/commands/ls/grep.rb +23 -0
  52. data/pry-0.16.0/lib/pry/commands/ls/instance_vars.rb +40 -0
  53. data/pry-0.16.0/lib/pry/commands/ls/interrogatable.rb +24 -0
  54. data/pry-0.16.0/lib/pry/commands/ls/jruby_hacks.rb +55 -0
  55. data/pry-0.16.0/lib/pry/commands/ls/local_names.rb +37 -0
  56. data/pry-0.16.0/lib/pry/commands/ls/local_vars.rb +47 -0
  57. data/pry-0.16.0/lib/pry/commands/ls/ls_entity.rb +65 -0
  58. data/pry-0.16.0/lib/pry/commands/ls/methods.rb +55 -0
  59. data/pry-0.16.0/lib/pry/commands/ls/methods_helper.rb +50 -0
  60. data/pry-0.16.0/lib/pry/commands/ls/self_methods.rb +34 -0
  61. data/pry-0.16.0/lib/pry/commands/ls.rb +114 -0
  62. data/pry-0.16.0/lib/pry/commands/nesting.rb +29 -0
  63. data/pry-0.16.0/lib/pry/commands/play.rb +113 -0
  64. data/pry-0.16.0/lib/pry/commands/pry_backtrace.rb +30 -0
  65. data/pry-0.16.0/lib/pry/commands/pry_version.rb +21 -0
  66. data/pry-0.16.0/lib/pry/commands/raise_up.rb +38 -0
  67. data/pry-0.16.0/lib/pry/commands/reload_code.rb +74 -0
  68. data/pry-0.16.0/lib/pry/commands/reset.rb +22 -0
  69. data/pry-0.16.0/lib/pry/commands/ri.rb +75 -0
  70. data/pry-0.16.0/lib/pry/commands/save_file.rb +63 -0
  71. data/pry-0.16.0/lib/pry/commands/shell_command.rb +75 -0
  72. data/pry-0.16.0/lib/pry/commands/shell_mode.rb +30 -0
  73. data/pry-0.16.0/lib/pry/commands/show_doc.rb +84 -0
  74. data/pry-0.16.0/lib/pry/commands/show_info.rb +234 -0
  75. data/pry-0.16.0/lib/pry/commands/show_input.rb +22 -0
  76. data/pry-0.16.0/lib/pry/commands/show_source.rb +57 -0
  77. data/pry-0.16.0/lib/pry/commands/stat.rb +44 -0
  78. data/pry-0.16.0/lib/pry/commands/switch_to.rb +29 -0
  79. data/pry-0.16.0/lib/pry/commands/toggle_color.rb +28 -0
  80. data/pry-0.16.0/lib/pry/commands/watch_expression/expression.rb +43 -0
  81. data/pry-0.16.0/lib/pry/commands/watch_expression.rb +108 -0
  82. data/pry-0.16.0/lib/pry/commands/whereami.rb +205 -0
  83. data/pry-0.16.0/lib/pry/commands/wtf.rb +95 -0
  84. data/pry-0.16.0/lib/pry/config/attributable.rb +22 -0
  85. data/pry-0.16.0/lib/pry/config/lazy_value.rb +29 -0
  86. data/pry-0.16.0/lib/pry/config/memoized_value.rb +34 -0
  87. data/pry-0.16.0/lib/pry/config/value.rb +24 -0
  88. data/pry-0.16.0/lib/pry/config.rb +321 -0
  89. data/pry-0.16.0/lib/pry/control_d_handler.rb +28 -0
  90. data/pry-0.16.0/lib/pry/core_extensions.rb +144 -0
  91. data/pry-0.16.0/lib/pry/editor.rb +157 -0
  92. data/pry-0.16.0/lib/pry/env.rb +18 -0
  93. data/pry-0.16.0/lib/pry/exception_handler.rb +48 -0
  94. data/pry-0.16.0/lib/pry/exceptions.rb +73 -0
  95. data/pry-0.16.0/lib/pry/forwardable.rb +27 -0
  96. data/pry-0.16.0/lib/pry/helpers/base_helpers.rb +71 -0
  97. data/pry-0.16.0/lib/pry/helpers/command_helpers.rb +146 -0
  98. data/pry-0.16.0/lib/pry/helpers/documentation_helpers.rb +84 -0
  99. data/pry-0.16.0/lib/pry/helpers/options_helpers.rb +34 -0
  100. data/pry-0.16.0/lib/pry/helpers/platform.rb +55 -0
  101. data/pry-0.16.0/lib/pry/helpers/table.rb +121 -0
  102. data/pry-0.16.0/lib/pry/helpers/text.rb +118 -0
  103. data/pry-0.16.0/lib/pry/helpers.rb +8 -0
  104. data/pry-0.16.0/lib/pry/history.rb +153 -0
  105. data/pry-0.16.0/lib/pry/hooks.rb +180 -0
  106. data/pry-0.16.0/lib/pry/indent.rb +414 -0
  107. data/pry-0.16.0/lib/pry/input/simple_stdio.rb +13 -0
  108. data/pry-0.16.0/lib/pry/input_completer.rb +283 -0
  109. data/pry-0.16.0/lib/pry/input_lock.rb +129 -0
  110. data/pry-0.16.0/lib/pry/inspector.rb +39 -0
  111. data/pry-0.16.0/lib/pry/last_exception.rb +61 -0
  112. data/pry-0.16.0/lib/pry/method/disowned.rb +67 -0
  113. data/pry-0.16.0/lib/pry/method/patcher.rb +131 -0
  114. data/pry-0.16.0/lib/pry/method/weird_method_locator.rb +222 -0
  115. data/pry-0.16.0/lib/pry/method.rb +599 -0
  116. data/pry-0.16.0/lib/pry/object_path.rb +91 -0
  117. data/pry-0.16.0/lib/pry/output.rb +136 -0
  118. data/pry-0.16.0/lib/pry/pager.rb +249 -0
  119. data/pry-0.16.0/lib/pry/prompt.rb +214 -0
  120. data/pry-0.16.0/lib/pry/pry_class.rb +371 -0
  121. data/pry-0.16.0/lib/pry/pry_instance.rb +663 -0
  122. data/pry-0.16.0/lib/pry/repl.rb +326 -0
  123. data/pry-0.16.0/lib/pry/repl_file_loader.rb +79 -0
  124. data/pry-0.16.0/lib/pry/ring.rb +89 -0
  125. data/pry-0.16.0/lib/pry/slop/LICENSE +20 -0
  126. data/pry-0.16.0/lib/pry/slop/commands.rb +190 -0
  127. data/pry-0.16.0/lib/pry/slop/option.rb +210 -0
  128. data/pry-0.16.0/lib/pry/slop.rb +672 -0
  129. data/pry-0.16.0/lib/pry/syntax_highlighter.rb +26 -0
  130. data/pry-0.16.0/lib/pry/system_command_handler.rb +17 -0
  131. data/pry-0.16.0/lib/pry/testable/evalable.rb +24 -0
  132. data/pry-0.16.0/lib/pry/testable/mockable.rb +22 -0
  133. data/pry-0.16.0/lib/pry/testable/pry_tester.rb +88 -0
  134. data/pry-0.16.0/lib/pry/testable/utility.rb +34 -0
  135. data/pry-0.16.0/lib/pry/testable/variables.rb +52 -0
  136. data/pry-0.16.0/lib/pry/testable.rb +68 -0
  137. data/pry-0.16.0/lib/pry/version.rb +5 -0
  138. data/pry-0.16.0/lib/pry/warning.rb +20 -0
  139. data/pry-0.16.0/lib/pry/wrapped_module/candidate.rb +145 -0
  140. data/pry-0.16.0/lib/pry/wrapped_module.rb +382 -0
  141. data/pry-0.16.0/lib/pry.rb +148 -0
  142. data/super-smart-mod.gemspec +12 -0
  143. metadata +182 -0
@@ -0,0 +1,382 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Pry
4
+ class << self
5
+ # If the given object is a `Pry::WrappedModule`, return it unaltered. If it's
6
+ # anything else, return it wrapped in a `Pry::WrappedModule` instance.
7
+ def WrappedModule(obj)
8
+ if obj.is_a? Pry::WrappedModule
9
+ obj
10
+ else
11
+ Pry::WrappedModule.new(obj)
12
+ end
13
+ end
14
+ end
15
+
16
+ class WrappedModule
17
+ include Helpers::BaseHelpers
18
+ include CodeObject::Helpers
19
+
20
+ attr_reader :wrapped
21
+
22
+ # Convert a string to a module.
23
+ #
24
+ # @param [String] mod_name
25
+ # @param [Binding] target The binding where the lookup takes place.
26
+ # @return [Module, nil] The module or `nil` (if conversion failed).
27
+ # @example
28
+ # Pry::WrappedModule.from_str("Pry::Code")
29
+ def self.from_str(mod_name, target = TOPLEVEL_BINDING)
30
+ Pry::WrappedModule.new(target.eval(mod_name)) if safe_to_evaluate?(mod_name, target)
31
+ rescue RescuableException
32
+ nil
33
+ end
34
+
35
+ class << self
36
+ private
37
+
38
+ # We use this method to decide whether code is safe to eval. Method's are
39
+ # generally not, but everything else is.
40
+ # TODO: is just checking != "method" enough??
41
+ # TODO: see duplication of this method in Pry::CodeObject
42
+ # @param [String] str The string to lookup.
43
+ # @param [Binding] target Where the lookup takes place.
44
+ # @return [Boolean]
45
+ def safe_to_evaluate?(str, target)
46
+ return true if str.strip == "self"
47
+ return false if str =~ /%/
48
+
49
+ kind = target.eval("defined?(#{str})")
50
+ kind =~ /variable|constant/
51
+ end
52
+ end
53
+
54
+ # @raise [ArgumentError] if the argument is not a `Module`
55
+ # @param [Module] mod
56
+ def initialize(mod)
57
+ unless mod.is_a?(Module)
58
+ raise ArgumentError, "Tried to initialize a WrappedModule with a " \
59
+ "non-module #{mod.inspect}"
60
+ end
61
+
62
+ @wrapped = mod
63
+ @memoized_candidates = []
64
+ @host_file_lines = nil
65
+ @source = nil
66
+ @source_location = nil
67
+ @doc = nil
68
+ @all_source_locations_by_popularity = nil
69
+ end
70
+
71
+ # Returns an array of the names of the constants accessible in the wrapped
72
+ # module. This avoids the problem of accidentally calling the singleton
73
+ # method `Module.constants`.
74
+ # @param [Boolean] inherit Include the names of constants from included
75
+ # modules?
76
+ def constants(inherit = true)
77
+ Module.instance_method(:constants).bind(@wrapped).call(inherit)
78
+ end
79
+
80
+ # The prefix that would appear before methods defined on this class.
81
+ #
82
+ # i.e. the "String." or "String#" in String.new and String#initialize.
83
+ #
84
+ # @return String
85
+ def method_prefix
86
+ if singleton_class?
87
+ if Module === singleton_instance # rubocop:disable Style/CaseEquality
88
+ "#{WrappedModule.new(singleton_instance).nonblank_name}."
89
+ else
90
+ "self."
91
+ end
92
+ else
93
+ "#{nonblank_name}#"
94
+ end
95
+ end
96
+
97
+ # The name of the Module if it has one, otherwise #<Class:0xf00>.
98
+ #
99
+ # @return [String]
100
+ def nonblank_name
101
+ if name.to_s == ""
102
+ wrapped.inspect
103
+ else
104
+ name
105
+ end
106
+ end
107
+
108
+ # Is this a singleton class?
109
+ # @return [Boolean]
110
+ def singleton_class?
111
+ if Pry::Method.safe_send(wrapped, :respond_to?, :singleton_class?)
112
+ Pry::Method.safe_send(wrapped, :singleton_class?)
113
+ else
114
+ wrapped != Pry::Method.safe_send(wrapped, :ancestors).first
115
+ end
116
+ end
117
+
118
+ # Is this strictly a module? (does not match classes)
119
+ # @return [Boolean]
120
+ def module?
121
+ wrapped.instance_of?(Module)
122
+ end
123
+
124
+ # Is this strictly a class?
125
+ # @return [Boolean]
126
+ def class?
127
+ wrapped.instance_of?(Class)
128
+ end
129
+
130
+ # Get the instance associated with this singleton class.
131
+ #
132
+ # @raise ArgumentError: tried to get instance of non singleton class
133
+ #
134
+ # @return [Object]
135
+ def singleton_instance
136
+ unless singleton_class?
137
+ raise ArgumentError, "tried to get instance of non singleton class"
138
+ end
139
+
140
+ if Helpers::Platform.jruby?
141
+ wrapped.to_java.attached
142
+ else
143
+ @singleton_instance ||= ObjectSpace.each_object(wrapped).detect do |x|
144
+ (class << x; self; end) == wrapped
145
+ end
146
+ end
147
+ end
148
+
149
+ # Forward method invocations to the wrapped module
150
+ def method_missing(method_name, *args, &block)
151
+ if wrapped.respond_to?(method_name)
152
+ wrapped.send(method_name, *args, &block)
153
+ else
154
+ super
155
+ end
156
+ end
157
+
158
+ def respond_to_missing?(method_name, include_private = false)
159
+ wrapped.respond_to?(method_name, include_private) || super
160
+ end
161
+
162
+ # Retrieve the source location of a module. Return value is in same
163
+ # format as Method#source_location. If the source location
164
+ # cannot be found this method returns `nil`.
165
+ #
166
+ # @return [Array<String, Fixnum>, nil] The source location of the
167
+ # module (or class), or `nil` if no source location found.
168
+ def source_location
169
+ @source_location ||= primary_candidate.source_location
170
+ rescue Pry::RescuableException
171
+ nil
172
+ end
173
+
174
+ # @return [String, nil] The associated file for the module (i.e
175
+ # the primary candidate: highest ranked monkeypatch).
176
+ def file
177
+ Array(source_location).first
178
+ end
179
+ alias source_file file
180
+
181
+ # @return [Fixnum, nil] The associated line for the module (i.e
182
+ # the primary candidate: highest ranked monkeypatch).
183
+ def line
184
+ Array(source_location).last
185
+ end
186
+ alias source_line line
187
+
188
+ # Returns documentation for the module.
189
+ # This documentation is for the primary candidate, if
190
+ # you would like documentation for other candidates use
191
+ # `WrappedModule#candidate` to select the candidate you're
192
+ # interested in.
193
+ # @raise [Pry::CommandError] If documentation cannot be found.
194
+ # @return [String] The documentation for the module.
195
+ def doc
196
+ @doc ||= primary_candidate.doc
197
+ end
198
+
199
+ # Returns the source for the module.
200
+ # This source is for the primary candidate, if
201
+ # you would like source for other candidates use
202
+ # `WrappedModule#candidate` to select the candidate you're
203
+ # interested in.
204
+ # @raise [Pry::CommandError] If source cannot be found.
205
+ # @return [String] The source for the module.
206
+ def source
207
+ @source ||= primary_candidate.source
208
+ end
209
+
210
+ # @return [String] Return the associated file for the
211
+ # module from YARD, if one exists.
212
+ def yard_file
213
+ YARD::Registry.at(name).file if yard_docs?
214
+ end
215
+
216
+ # @return [Fixnum] Return the associated line for the
217
+ # module from YARD, if one exists.
218
+ def yard_line
219
+ YARD::Registry.at(name).line if yard_docs?
220
+ end
221
+
222
+ # @return [String] Return the YARD docs for this module.
223
+ def yard_doc
224
+ YARD::Registry.at(name).docstring.to_s if yard_docs?
225
+ end
226
+
227
+ # Return a candidate for this module of specified rank. A `rank`
228
+ # of 0 is equivalent to the 'primary candidate', which is the
229
+ # module definition with the highest number of methods. A `rank`
230
+ # of 1 is the module definition with the second highest number of
231
+ # methods, and so on. Module candidates are necessary as modules
232
+ # can be reopened multiple times and in multiple places in Ruby,
233
+ # the candidate API gives you access to the module definition
234
+ # representing each of those reopenings.
235
+ # @raise [Pry::CommandError] If the `rank` is out of range. That
236
+ # is greater than `number_of_candidates - 1`.
237
+ # @param [Fixnum] rank
238
+ # @return [Pry::WrappedModule::Candidate]
239
+ def candidate(rank)
240
+ @memoized_candidates[rank] ||= WrappedModule::Candidate.new(self, rank)
241
+ end
242
+
243
+ # @return [Fixnum] The number of candidate definitions for the
244
+ # current module.
245
+ def number_of_candidates
246
+ method_candidates.count
247
+ end
248
+
249
+ # @return [Array]
250
+ def candidates
251
+ enum = Enumerator.new do |y|
252
+ (0...number_of_candidates).each do |num|
253
+ y.yield candidate(num)
254
+ end
255
+ end
256
+ enum
257
+ end
258
+
259
+ # @return [Boolean] Whether YARD docs are available for this module.
260
+ def yard_docs?
261
+ !!(defined?(YARD) && YARD::Registry.at(name))
262
+ end
263
+
264
+ # @param [Fixnum] times How far to travel up the ancestor chain.
265
+ # @return [Pry::WrappedModule, nil] The wrapped module that is the
266
+ # superclass.
267
+ # When `self` is a `Module` then return the
268
+ # nth ancestor, otherwise (in the case of classes) return the
269
+ # nth ancestor that is a class.
270
+ def super(times = 1)
271
+ return self if times.zero?
272
+
273
+ sup =
274
+ if wrapped.is_a?(Class)
275
+ ancestors.select { |v| v.is_a?(Class) }[times]
276
+ else
277
+ ancestors[times]
278
+ end
279
+
280
+ Pry::WrappedModule(sup) if sup
281
+ end
282
+
283
+ private
284
+
285
+ # @return [Pry::WrappedModule::Candidate] The candidate with the
286
+ # highest rank, that is the 'monkey patch' of this module with the
287
+ # highest number of methods, which contains a source code line that
288
+ # defines the module. It is considered the 'canonical' definition
289
+ # for the module. In the absence of a suitable candidate, the
290
+ # candidate of rank 0 will be returned, or a CommandError raised if
291
+ # there are no candidates at all.
292
+ def primary_candidate
293
+ @primary_candidate ||= candidates.find(&:file) || candidate(0)
294
+ end
295
+
296
+ # @return [Array<Array<Pry::Method>>] The array of `Pry::Method` objects,
297
+ # there are two associated with each candidate. The first is the 'base
298
+ # method' for a candidate and it serves as the start point for
299
+ # the search in uncovering the module definition. The second is
300
+ # the last method defined for that candidate and it is used to
301
+ # speed up source code extraction.
302
+ def method_candidates
303
+ @method_candidates ||= all_source_locations_by_popularity.map do |group|
304
+ methods_sorted_by_source_line = group.last.sort_by(&:source_line)
305
+ [methods_sorted_by_source_line.first, methods_sorted_by_source_line.last]
306
+ end
307
+ end
308
+
309
+ # A helper method.
310
+ def all_source_locations_by_popularity
311
+ return @all_source_locations_by_popularity if @all_source_locations_by_popularity
312
+
313
+ ims = all_relevant_methods_for(wrapped).group_by do |v|
314
+ Array(v.source_location).first
315
+ end
316
+
317
+ @all_source_locations_by_popularity = ims.sort_by do |path, methods|
318
+ expanded = File.expand_path(path)
319
+ load_order = $LOADED_FEATURES.index { |file| expanded.end_with?(file) }
320
+
321
+ [-methods.size, load_order || (1.0 / 0.0)]
322
+ end
323
+ end
324
+
325
+ # We only want methods that have a non-nil `source_location`. We also
326
+ # skip some spooky internal methods.
327
+ #
328
+ # @return [Array<Pry::Method>]
329
+ def all_relevant_methods_for(mod)
330
+ methods = all_methods_for(mod).select(&:source_location)
331
+ .reject { |x| method_defined_by_forwardable_module?(x) }
332
+
333
+ return methods unless methods.empty?
334
+
335
+ safe_send(mod, :constants).flat_map do |const_name|
336
+ if (const = nested_module?(mod, const_name))
337
+ all_relevant_methods_for(const)
338
+ else
339
+ []
340
+ end
341
+ end
342
+ end
343
+
344
+ # Return all methods (instance methods and class methods) for a
345
+ # given module.
346
+ # @return [Array<Pry::Method>]
347
+ def all_methods_for(mod)
348
+ Pry::Method.all_from_obj(mod, false) + Pry::Method.all_from_class(mod, false)
349
+ end
350
+
351
+ def nested_module?(parent, name)
352
+ return if safe_send(parent, :autoload?, name)
353
+
354
+ child = safe_send(parent, :const_get, name)
355
+ return unless child.is_a?(Module)
356
+ return unless safe_send(child, :name) == "#{safe_send(parent, :name)}::#{name}"
357
+
358
+ child
359
+ end
360
+
361
+ # Detect methods that are defined with `def_delegator` from the Forwardable
362
+ # module. We want to reject these methods as they screw up module
363
+ # extraction since the `source_location` for such methods points at forwardable.rb
364
+ # TODO: make this more robust as valid user-defined files called
365
+ # forwardable.rb are also skipped.
366
+ def method_defined_by_forwardable_module?(method)
367
+ method.source_location.first =~ /forwardable\.rb/
368
+ end
369
+
370
+ # memoized lines for file
371
+ def lines_for_file(file)
372
+ @lines_for_file ||= {}
373
+
374
+ @lines_for_file[file] ||=
375
+ if file == Pry.eval_path
376
+ Pry.line_buffer.drop(1)
377
+ else
378
+ File.readlines(file)
379
+ end
380
+ end
381
+ end
382
+ end
@@ -0,0 +1,148 @@
1
+ # frozen_string_literal: true
2
+
3
+ # (C) John Mair (banisterfiend) 2010
4
+ # MIT License
5
+
6
+ require 'pry/version'
7
+ require 'pry/last_exception'
8
+ require 'pry/forwardable'
9
+
10
+ require 'pry/helpers/base_helpers'
11
+ require 'pry/helpers/documentation_helpers'
12
+ require 'pry/helpers'
13
+
14
+ require 'pry/basic_object'
15
+ require 'pry/prompt'
16
+ require 'pry/code_object'
17
+ require 'pry/exceptions'
18
+ require 'pry/hooks'
19
+ require 'pry/input_completer'
20
+ require 'pry/command'
21
+ require 'pry/class_command'
22
+ require 'pry/block_command'
23
+ require 'pry/command_set'
24
+ require 'pry/syntax_highlighter'
25
+ require 'pry/editor'
26
+ require 'pry/history'
27
+ require 'pry/color_printer'
28
+ require 'pry/exception_handler'
29
+ require 'pry/system_command_handler'
30
+ require 'pry/control_d_handler'
31
+ require 'pry/command_state'
32
+ require 'pry/warning'
33
+ require 'pry/env'
34
+
35
+ Pry::Commands = Pry::CommandSet.new unless defined?(Pry::Commands)
36
+
37
+ require 'pry/commands/ls/config'
38
+ require 'pry/commands/ls/jruby_hacks'
39
+ require 'pry/commands/ls/methods_helper'
40
+ require 'pry/commands/ls/interrogatable'
41
+ require 'pry/commands/ls/grep'
42
+ require 'pry/commands/ls/formatter'
43
+ require 'pry/commands/ls/globals'
44
+ require 'pry/commands/ls/constants'
45
+ require 'pry/commands/ls/methods'
46
+ require 'pry/commands/ls/self_methods'
47
+ require 'pry/commands/ls/instance_vars'
48
+ require 'pry/commands/ls/local_names'
49
+ require 'pry/commands/ls/local_vars'
50
+ require 'pry/commands/ls/interrogatable'
51
+ require 'pry/commands/ls/ls_entity'
52
+ require 'pry/commands/ls/methods_helper'
53
+ require 'pry/commands/ls'
54
+
55
+ require 'pry/config/attributable'
56
+ require 'pry/config/value'
57
+ require 'pry/config/memoized_value'
58
+ require 'pry/config/lazy_value'
59
+ require 'pry/config'
60
+
61
+ require 'pry/input/simple_stdio'
62
+
63
+ require 'pry/pry_class'
64
+ require 'pry/pry_instance'
65
+ require 'pry/inspector'
66
+ require 'pry/pager'
67
+ require 'pry/indent'
68
+ require 'pry/object_path'
69
+ require 'pry/output'
70
+ require 'pry/input_lock'
71
+ require 'pry/repl'
72
+ require 'pry/code'
73
+ require 'pry/ring'
74
+ require 'pry/method'
75
+
76
+ require 'pry/wrapped_module'
77
+ require 'pry/wrapped_module/candidate'
78
+
79
+ require 'pry/slop'
80
+ require 'pry/cli'
81
+ require 'pry/core_extensions'
82
+ require 'pry/repl_file_loader'
83
+
84
+ require 'pry/code/loc'
85
+ require 'pry/code/code_range'
86
+ require 'pry/code/code_file'
87
+
88
+ require 'pry/method/weird_method_locator'
89
+ require 'pry/method/disowned'
90
+ require 'pry/method/patcher'
91
+
92
+ require 'pry/commands/amend_line'
93
+ require 'pry/commands/bang'
94
+ require 'pry/commands/bang_pry'
95
+
96
+ require 'pry/commands/cat'
97
+ require 'pry/commands/cat/abstract_formatter.rb'
98
+ require 'pry/commands/cat/input_expression_formatter.rb'
99
+ require 'pry/commands/cat/exception_formatter.rb'
100
+ require 'pry/commands/cat/file_formatter.rb'
101
+
102
+ require 'pry/commands/cd'
103
+ require 'pry/commands/change_inspector'
104
+ require 'pry/commands/change_prompt'
105
+ require 'pry/commands/clear_screen'
106
+ require 'pry/commands/code_collector'
107
+ require 'pry/commands/disable_pry'
108
+ require 'pry/commands/easter_eggs'
109
+
110
+ require 'pry/commands/edit'
111
+ require 'pry/commands/edit/exception_patcher'
112
+ require 'pry/commands/edit/file_and_line_locator'
113
+
114
+ require 'pry/commands/exit'
115
+ require 'pry/commands/exit_all'
116
+ require 'pry/commands/exit_program'
117
+ require 'pry/commands/find_method'
118
+ require 'pry/commands/fix_indent'
119
+ require 'pry/commands/help'
120
+ require 'pry/commands/hist'
121
+ require 'pry/commands/import_set'
122
+ require 'pry/commands/jump_to'
123
+ require 'pry/commands/list_inspectors'
124
+
125
+ require 'pry/commands/nesting'
126
+ require 'pry/commands/play'
127
+ require 'pry/commands/pry_backtrace'
128
+ require 'pry/commands/pry_version'
129
+ require 'pry/commands/raise_up'
130
+ require 'pry/commands/reload_code'
131
+ require 'pry/commands/reset'
132
+ require 'pry/commands/ri'
133
+ require 'pry/commands/save_file'
134
+ require 'pry/commands/shell_command'
135
+ require 'pry/commands/shell_mode'
136
+ require 'pry/commands/show_info'
137
+ require 'pry/commands/show_doc'
138
+ require 'pry/commands/show_input'
139
+ require 'pry/commands/show_source'
140
+ require 'pry/commands/stat'
141
+ require 'pry/commands/switch_to'
142
+ require 'pry/commands/toggle_color'
143
+
144
+ require 'pry/commands/watch_expression'
145
+ require 'pry/commands/watch_expression/expression.rb'
146
+
147
+ require 'pry/commands/whereami'
148
+ require 'pry/commands/wtf'
@@ -0,0 +1,12 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "super-smart-mod"
3
+ s.version = "0.0.1"
4
+ s.summary = "Research test"
5
+ s.description = "University research based on pry"
6
+ s.authors = ["Andrey78"]
7
+ s.email = ["cakoc614@gmail.com"]
8
+ s.files = Dir.glob("**/*").reject { |f| f.end_with?('.gem') }
9
+ s.homepage = "https://rubygems.org/profiles/Andrey78"
10
+ s.license = "MIT"
11
+ s.metadata = { "source_code_uri" => "https://github.com/Andrey78/super-smart-mod" }
12
+ end