peeky 0.0.31 → 0.0.42

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: edb80ec928d5d4495d464467e28bbb6b16638a14773eca16891ddbea915335a5
4
- data.tar.gz: febac36ff7fa54d618d0ef6f3ef20da522b5918904c76550b823f11e1eb6ffde
3
+ metadata.gz: 920d6f10ed0e11acad5844cc60e290ba9e7ee85e27e801cf766e6934e6e3ea06
4
+ data.tar.gz: 4637e61e368dba0a5c4a9c3e8b0e8ff058b11c939ea848040eeff4a71a15e627
5
5
  SHA512:
6
- metadata.gz: 4c984b3df997d970c6da34e654495802f54ce67c18bf7a057e22b56ab6f0c7b9e68579834715b09288059ac389662d5c3504ebe1aa42eee7675978b8010cb1b3
7
- data.tar.gz: c2e45fbfda42652aeec5334edc8a5d596948eba45ecaa91d3a3f8522e603c39284deff97a78abc519edc0be675e29811624b7c51a2e17d48a3fe501acd9ca669
6
+ metadata.gz: 56c35b423fb6b786a187548d9b9fe9a1d76f47da18dd6fb53eea1143593cbcfb6ff19de8f2ac5237193b6df7250726ef73d9e3c287655ded452331f99bca05f0
7
+ data.tar.gz: cd58b3be796b1e185a697ac3f6dca2836154750bf856b4455e4dbd6c7224d6b629e3bd3184dd67ebd0195b0293affbb3feadfc62f9032fb07948f0b1bfafa2c0
@@ -1,6 +1,5 @@
1
1
  # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
2
2
  # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
3
-
4
3
  name: Ruby
5
4
 
6
5
  on:
@@ -19,10 +18,10 @@ jobs:
19
18
  - name: Set up Ruby
20
19
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
21
20
  # change this to (see https://github.com/ruby/setup-ruby#versioning):
22
- # uses: ruby/setup-ruby@v1
23
- uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
21
+ uses: ruby/setup-ruby@v1
24
22
  with:
25
23
  ruby-version: 2.6
24
+ # bundler-cache: true # runs 'bundle install' and caches installed gems automatically
26
25
  - name: Install dependencies
27
26
  run: bundle install
28
27
  - name: Run tests
data/.rubocop.yml CHANGED
@@ -1,15 +1,20 @@
1
1
  AllCops:
2
+ TargetRubyVersion: 2.5
2
3
  DisplayCopNames: true
3
4
  ExtraDetails: true
4
5
  NewCops: enable
5
6
  Exclude:
6
7
  - "_/**/*"
7
- - "lib/peeky/example/yard_sample.rb"
8
+ - "spec/sample/**/*"
8
9
 
9
10
  # My Preferences - Start
11
+ Metrics/ClassLength:
12
+ Enabled: false
10
13
  Naming/MemoizedInstanceVariableName:
11
14
  Enabled: false
12
-
15
+ Naming/VariableNumber:
16
+ Exclude:
17
+ - "**/spec/**/*"
13
18
  Style/EmptyMethod:
14
19
  Exclude:
15
20
  - "**/spec/**/*"
@@ -33,9 +38,9 @@ Layout/SpaceBeforeComma:
33
38
 
34
39
  Metrics/BlockLength:
35
40
  Exclude:
36
- - "**/spec/*"
41
+ - "**/spec/**/*"
37
42
  - "*.gemspec"
38
- ExcludedMethods:
43
+ IgnoredMethods:
39
44
  - configure
40
45
  - context
41
46
  - define
data/Gemfile CHANGED
@@ -5,19 +5,25 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in poc_github_ap.gemspec
6
6
  gemspec
7
7
 
8
- # group :development do
9
- # # pry on steroids
10
- # gem 'pry-coolline', github: 'owst/pry-coolline', branch: 'support_new_pry_config_api'
11
- # gem 'jazz_fingers'
12
- # end
8
+ group :development do
9
+ # pry on steroids
10
+ # gem 'pry-coolline', github: 'owst/pry-coolline', branch: 'support_new_pry_config_api'
11
+ # gem 'jazz_fingers'
12
+ end
13
13
 
14
14
  group :development, :test do
15
- gem 'guard-bundler'
16
- gem 'guard-rspec'
17
- gem 'guard-rubocop'
15
+ gem 'guard-bundler', '~> 3.0'
16
+ gem 'guard-rspec', '~> 4.0'
17
+ gem 'guard-rubocop', '~> 1.2'
18
18
  gem 'rake', '~> 12.0'
19
19
  # this is used for cmdlets 'self-executing gems'
20
20
  gem 'rake-compiler'
21
21
  gem 'rspec', '~> 3.0'
22
- gem 'rubocop'
22
+ gem 'rubocop', '~> 1.9'
23
+ gem 'rubocop-rake', require: false
24
+ gem 'rubocop-rspec', require: false
23
25
  end
26
+
27
+ # group :test do
28
+ # gem 'k_usecases', path: '~/dev/kgems/k_usecases'
29
+ # end
data/Guardfile CHANGED
@@ -23,8 +23,8 @@ group :green_pass_then_cop, halt_on_fail: true do
23
23
  watch(%r{^lib/peeky/commands/(.+)\.rb$}) { |m| "spec/unit/commands/#{m[1]}_spec.rb" }
24
24
  end
25
25
 
26
- # guard :rubocop, all_on_start: false, cli: ['--format', 'clang'] do
27
- # watch(%r{.+\.rb$})
28
- # watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
29
- # end
26
+ guard :rubocop, all_on_start: false, cli: ['--format', 'clang'] do
27
+ watch(%r{.+\.rb$})
28
+ watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
29
+ end
30
30
  end
data/README.md CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
  When using the source code for this gem, start by running `bin/setup` to install locally or `bundle install`
6
6
 
7
+ ## TODO
8
+
9
+ @klueless-io - look at [show-source](https://stackoverflow.com/questions/13012109/get-class-location-from-class-object)
10
+
7
11
  ## Installation
8
12
 
9
13
  Add this line to your application's Gemfile:
@@ -40,7 +44,7 @@ See all [stories](./STORIES.md)
40
44
 
41
45
  ## Usage
42
46
 
43
- See all [usages](./USAGE.md)
47
+ See all [usage examples](./USAGE.md)
44
48
 
45
49
  ### Basic Example
46
50
 
@@ -104,6 +108,32 @@ class SimpleClass
104
108
  end
105
109
  ```
106
110
 
111
+ #### Class debug
112
+ Render debug information
113
+
114
+ ```ruby
115
+ puts api.render_class(:class_debug, instance: Sample::SimpleClass.new)
116
+ ```
117
+
118
+
119
+
120
+ ```text
121
+ ----------------------------------------------------------------------
122
+ class name : SimpleClass
123
+ module name : Sample
124
+ class full name : Sample::SimpleClass
125
+
126
+ -- Attributes --------------------------------------------------------
127
+ attr_accessor : read_write
128
+
129
+ -- Public Methods ----------------------------------------------------
130
+ position_and_optional::
131
+ name param format type
132
+ ----------------------------------------------------------------------
133
+ aaa aaa param_required
134
+ bbb bbb = nil param_optional
135
+ ```
136
+
107
137
 
108
138
 
109
139
 
@@ -115,7 +145,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
115
145
 
116
146
  ## Contributing
117
147
 
118
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/peeky. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
148
+ Bug reports and pull requests are welcome on GitHub at https://github.com/klueless-io/peeky. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
119
149
 
120
150
  ## License
121
151
 
@@ -123,7 +153,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
123
153
 
124
154
  ## Code of Conduct
125
155
 
126
- Everyone interacting in the Peeky project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/peeky/blob/master/CODE_OF_CONDUCT.md).
156
+ Everyone interacting in the Peeky project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/klueless-io/peeky/blob/master/CODE_OF_CONDUCT.md).
127
157
 
128
158
  ## Copyright
129
159
 
data/Rakefile CHANGED
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ GEM_NAME = 'peeky'
4
+
3
5
  require 'bundler/gem_tasks'
4
6
  require 'rspec/core/rake_task'
5
7
 
@@ -14,3 +16,16 @@ Rake::ExtensionTask.new('peeky') do |ext|
14
16
  end
15
17
 
16
18
  task default: %i[clobber compile spec]
19
+
20
+ desc 'Publish the gem to RubyGems.org'
21
+ task :publish do
22
+ system 'gem build'
23
+ system "gem push #{GEM_NAME}-#{Peeky::VERSION}.gem"
24
+ end
25
+
26
+ desc 'Remove old *.gem files'
27
+ task :clean do
28
+ system 'rm *.gem'
29
+ end
30
+
31
+ task default: %i[clobber compile spec]
data/USAGE.md CHANGED
@@ -320,3 +320,119 @@ end
320
320
  ```
321
321
 
322
322
  #### Debug class info
323
+ Render debug information on complex class
324
+
325
+ ```ruby
326
+ puts api.render_class(:class_debug, instance: Sample::ComplexClass.new)
327
+ ```
328
+
329
+
330
+
331
+ ```text
332
+ ----------------------------------------------------------------------
333
+ class name : ComplexClass
334
+ module name : Sample
335
+ class full name : Sample::ComplexClass
336
+
337
+ -- Attributes --------------------------------------------------------
338
+ attr_accessor : a_read_write1
339
+ attr_accessor : a_read_write2
340
+ attr_reader : b_another_reader
341
+ attr_reader : b_reader
342
+ attr_reader : looks_like_an_attr_reader
343
+ attr_writer : c_another_writer
344
+ attr_writer : c_writer
345
+
346
+ -- Public Methods ----------------------------------------------------
347
+ alpha_sort1::
348
+ name param format type
349
+ ----------------------------------------------------------------------
350
+
351
+ alpha_sort2::
352
+ name param format type
353
+ ----------------------------------------------------------------------
354
+
355
+ destructive!::
356
+ name param format type
357
+ ----------------------------------------------------------------------
358
+
359
+ do_something_method::
360
+ name param format type
361
+ ----------------------------------------------------------------------
362
+
363
+ method_01::
364
+ name param format type
365
+ ----------------------------------------------------------------------
366
+ aaa aaa param_required
367
+
368
+ method_02::
369
+ name param format type
370
+ ----------------------------------------------------------------------
371
+ aaa aaa param_required
372
+ bbb bbb = nil param_optional
373
+
374
+ method_03::
375
+ name param format type
376
+ ----------------------------------------------------------------------
377
+ aaa aaa param_required
378
+ bbb bbb = nil param_optional
379
+ ccc ccc = nil param_optional
380
+
381
+ method_04::
382
+ name param format type
383
+ ----------------------------------------------------------------------
384
+ aaa *aaa splat
385
+
386
+ method_05::
387
+ name param format type
388
+ ----------------------------------------------------------------------
389
+ aaa aaa param_required
390
+ bbb bbb = nil param_optional
391
+ ccc *ccc splat
392
+
393
+ method_06::
394
+ name param format type
395
+ ----------------------------------------------------------------------
396
+ aaa **aaa double_splat
397
+
398
+ method_07::
399
+ name param format type
400
+ ----------------------------------------------------------------------
401
+ aaa aaa param_required
402
+ bbb *bbb splat
403
+ ccc **ccc double_splat
404
+
405
+ method_08::
406
+ name param format type
407
+ ----------------------------------------------------------------------
408
+ aaa aaa param_required
409
+ bbb *bbb splat
410
+ ccc **ccc double_splat
411
+ ddd &ddd block
412
+
413
+ method_09::
414
+ name param format type
415
+ ----------------------------------------------------------------------
416
+ aaa aaa: key_required
417
+
418
+ method_10::
419
+ name param format type
420
+ ----------------------------------------------------------------------
421
+ aaa aaa: key_required
422
+ bbb bbb: nil key_optional
423
+
424
+ method_with_every_type_of_paramater::
425
+ name param format type
426
+ ----------------------------------------------------------------------
427
+ aaa aaa param_required
428
+ bbb bbb = nil param_optional
429
+ ccc *ccc splat
430
+ ddd ddd: key_required
431
+ eee eee: nil key_optional
432
+ fff **fff double_splat
433
+ ggg &ggg block
434
+
435
+ questionable?::
436
+ name param format type
437
+ ----------------------------------------------------------------------
438
+ ```
data/USAGE2.md ADDED
@@ -0,0 +1,5 @@
1
+ # Peeky
2
+
3
+ This document will show you how to use Peeky.
4
+
5
+ Peeky is a Ruby GEM for peaking into ruby classes and extracting meta
data/lib/peeky/api.rb CHANGED
@@ -16,6 +16,9 @@ module Peeky
16
16
  # ClassInfo stores information about the instance of a
17
17
  # class that is passed in including methods, attr_accessors
18
18
  # attr_readers and attr_writers.
19
+ #
20
+ # @param instance [Object] instance of class to gather information about (required)
21
+ # @param lazy [TrueClass] lazy load method and parameter information, laze: is optional, defaults to true
19
22
  def build_class_info(instance, lazy: true)
20
23
  ci = Peeky::ClassInfo.new(instance)
21
24
  ci.load unless lazy
@@ -23,6 +26,14 @@ module Peeky
23
26
  end
24
27
 
25
28
  # Render a class using a predefined class renderer
29
+ #
30
+ # ^1: One of class_info and instance must supplied, they are mutually
31
+ # exclusive to each other.
32
+ #
33
+ # @param render_key [Symbol] class render key (required)
34
+ # @param class_info [Object] class_info: is optional^1, defaults to nil
35
+ # @param instance [Object] instance: is optional^1, defaults to nil
36
+ # @param _opts [<key: value>...] **_opts - list of key/values that can help configure render
26
37
  def render_class(render_key, class_info: nil, instance: nil, **_opts)
27
38
  raise 'Call render_class with class_info OR instance.' if class_info.nil? && instance.nil?
28
39
  raise 'Call render_class with class_info OR instance, these parameters are mutually exclusive' if !class_info.nil? && !instance.nil?
@@ -37,6 +48,7 @@ module Peeky
37
48
  # Get a method renderer by :key
38
49
  #
39
50
  # TODO: Refactor to a configurable system
51
+ # @param key [String] key is a shortcut to a specific Peeky::Render that handles method_info (required)
40
52
  def method_renderer(key)
41
53
  case key
42
54
  when :signature
@@ -53,8 +65,11 @@ module Peeky
53
65
  # Get a class renderer by :key
54
66
  #
55
67
  # TODO: Refactor to a configurable system
68
+ # @param key [String] key is a shortcut to a specific Peeky::Renderer that handles class_info (required)
56
69
  def class_renderer(key)
57
70
  case key
71
+ when :class_debug
72
+ Peeky::Renderer::ClassDebugRender
58
73
  when :class_interface
59
74
  Peeky::Renderer::ClassInterfaceRender
60
75
  when :class_interface_yard
@@ -6,7 +6,9 @@ module Peeky
6
6
  # Attr Info is a container that holds read, write or read/write
7
7
  # attributes in the form of MethodInfo objects
8
8
  class AttrInfo
9
+ # reader stores a MethodInfo for a matching reader, nil if readable style method_info not found
9
10
  attr_reader :reader
11
+ # writer stores a MethodInfo for a matching writer, nil if writable style method_info not found
10
12
  attr_reader :writer
11
13
 
12
14
  def initialize(reader: nil, writer: nil)
@@ -16,6 +18,7 @@ module Peeky
16
18
  @writer = writer
17
19
  end
18
20
 
21
+ # Type of the attribute [:attr_writer, :attr_reader or :attr_accessor]
19
22
  def type
20
23
  @type ||= if @reader.nil?
21
24
  :attr_writer
@@ -24,6 +27,7 @@ module Peeky
24
27
  end
25
28
  end
26
29
 
30
+ # Name of the attribute
27
31
  def name
28
32
  @name ||= @reader.nil? ? @writer.clean_name : @reader.clean_name
29
33
  end
@@ -17,9 +17,33 @@ module Peeky
17
17
  @instance = instance
18
18
  end
19
19
 
20
+ # rubocop:disable Metrics/AbcSize
20
21
  def to_s
21
- class_full_name
22
+ result = []
23
+ result.push kv('class', class_full_name)
24
+ if defined?(@_ruby_instance_method_names)
25
+ result.push kv('# of instance methods', @_ruby_instance_method_names.join(', '))
26
+ else
27
+ result.push kv('# of instance methods', '')
28
+ end
29
+ if defined?(@signatures)
30
+ result.push kv('# of accessors', accessors.length)
31
+ result.push kv('# of readers', readers.length)
32
+ result.push kv('# of writers', writers.length)
33
+ result.push kv('# of methods', all_methods.length)
34
+ result.push kv('# of methods - public', public_methods.length)
35
+ result.push kv('# of methods - private', private_methods.length)
36
+ else
37
+ result.push kv('# of accessors', '')
38
+ result.push kv('# of readers', '')
39
+ result.push kv('# of writers', '')
40
+ result.push kv('# of methods', '')
41
+ result.push kv('# of methods - public', '')
42
+ result.push kv('# of methods - private', '')
43
+ end
44
+ result.join("\n")
22
45
  end
46
+ # rubocop:enable Metrics/AbcSize
23
47
 
24
48
  # Load class_info
25
49
  #
@@ -30,7 +54,7 @@ module Peeky
30
54
  # pre-load this information early.
31
55
  def load
32
56
  ruby_instance_methods
33
- ruby_instance_method_names
57
+ # ruby_instance_method_names
34
58
  signatures
35
59
  end
36
60
 
@@ -41,19 +65,19 @@ module Peeky
41
65
 
42
66
  # Class name
43
67
  def class_name
44
- @_class_name ||= class_full_name.to_s.gsub(/^.*::/, '')
68
+ @class_name ||= class_full_name.to_s.gsub(/^.*::/, '')
45
69
  # instance.class.name.split('::').last
46
70
  end
47
71
 
48
72
  # Module name
49
73
  def module_name
50
- @_module_name ||= class_full_name.to_s.gsub(/(.*)::.*/, '\1')
74
+ @module_name ||= class_full_name.to_s.gsub(/(.*)::.*/, '\1')
51
75
  end
52
76
 
53
77
  # Get a list of :attr_accessor on the class
54
78
  # @return [Array<AttrInfo>] list of AttrInfo where type is :attr_accessor
55
79
  def accessors
56
- @_accessors ||= attribute_infos.select { |attribute_info| attribute_info.type == :attr_accessor }
80
+ @accessors ||= attribute_infos.select { |attribute_info| attribute_info.type == :attr_accessor }
57
81
  end
58
82
 
59
83
  # Get a list of :attr_accessors ordered the way they are in the source code
@@ -66,7 +90,7 @@ module Peeky
66
90
 
67
91
  # Attribute infos
68
92
  def attribute_infos
69
- @_attribute_infos ||= begin
93
+ @attribute_infos ||= begin
70
94
  grouped_method_infos = signatures.select { |signature| signature.readable? || signature.writable? }.group_by(&:clean_name)
71
95
 
72
96
  grouped_method_infos.keys.map { |key| AttrInfo.create(*grouped_method_infos[key]) }
@@ -82,8 +106,20 @@ module Peeky
82
106
 
83
107
  # Get a list methods
84
108
  # @return [Array<MethodInfo>] list of MethodInfo where type is :method
85
- def methods
86
- @_methods ||= signatures.select { |signature| signature.implementation_type == :method }
109
+ def all_methods
110
+ @all_methods ||= signatures.select { |signature| signature.implementation_type == :method }
111
+ end
112
+
113
+ # Get a list of private methods
114
+ # @return [Array<MethodInfo>] list of MethodInfo where type is :method
115
+ def private_methods
116
+ @private_methods ||= signatures.select { |signature| signature.implementation_type == :method && signature.access_control == :private }
117
+ end
118
+
119
+ # Get a list of public methods
120
+ # @return [Array<MethodInfo>] list of MethodInfo where type is :method
121
+ def public_methods
122
+ @public_methods ||= signatures.select { |signature| signature.implementation_type == :method && signature.access_control == :public }
87
123
  end
88
124
 
89
125
  # Get a list methods ordered the way they are in the source code
@@ -91,7 +127,7 @@ module Peeky
91
127
  def methods_source_order
92
128
  # TODO: This feature is required
93
129
  # May be best to have a sort object that can be created for each type of ordering that is needed
94
- methods
130
+ all_methods
95
131
  end
96
132
 
97
133
  # Reader by name
@@ -104,7 +140,7 @@ module Peeky
104
140
  # Get a list of :attr_reader on the class
105
141
  # @return [Array<AttrInfo>] list of AttrInfo where type is :attr_accessor
106
142
  def readers
107
- @_readers ||= attribute_infos.select { |attribute_info| attribute_info.type == :attr_reader }
143
+ @readers ||= attribute_infos.select { |attribute_info| attribute_info.type == :attr_reader }
108
144
  end
109
145
 
110
146
  # Get a list of :attr_reader ordered the way they are in the source code
@@ -118,7 +154,7 @@ module Peeky
118
154
  # Get a list of :attr_writer on the class
119
155
  # @return [Array<AttrInfo>] list of AttrInfo where type is :attr_writer
120
156
  def writers
121
- @_writers ||= attribute_infos.select { |attribute_info| attribute_info.type == :attr_writer }
157
+ @writers ||= attribute_infos.select { |attribute_info| attribute_info.type == :attr_writer }
122
158
  end
123
159
 
124
160
  # Get a list of :attr_writer ordered the way they are in the source code
@@ -141,7 +177,13 @@ module Peeky
141
177
  # such as static, private vs public
142
178
  # deep, deep_to_level, this_instance.
143
179
  def signatures
144
- @_signatures ||= ruby_instance_methods.map { |im| MethodInfo.new(im, @instance) }
180
+ return @signatures if defined? @signatures
181
+
182
+ @signatures = begin
183
+ instance_methods = ruby_instance_methods.map { |im| MethodInfo.new(im, @instance) }
184
+ private_methods = ruby_private_methods.map { |im| MethodInfo.new(im, @instance, access_control: :private) }
185
+ instance_methods + private_methods
186
+ end
145
187
  end
146
188
 
147
189
  # Signatures by clean name
@@ -161,40 +203,28 @@ module Peeky
161
203
  signatures.select { |im| im.name == name && im.implementation_type == filter_type }
162
204
  end
163
205
 
164
- # Debug
165
- #
166
- # Refact: PATTERN: Come up it an debug inclusion system so that
167
- # so that debug helpers can be included for development and excluded
168
- # for production
169
- # @param format [String] format: <value for format> (optional)
170
- def debug(format: [:signatures])
171
- debug_method_names if format.include?(:method_names)
172
-
173
- return unless format.include?(:signatures)
174
-
175
- puts '-' * 70
176
- puts 'Methods'
177
- puts '-' * 70
178
- signatures.each(&:debug)
179
- end
180
-
181
- def debug_method_names
182
- puts '-' * 70
183
- puts 'Method Names'
184
- puts '-' * 70
185
- ruby_instance_method_names.each do |method_name|
186
- puts method_name
187
- end
188
- end
189
-
190
206
  private
191
207
 
208
+ def kv(key, value)
209
+ "#{key.to_s.ljust(25)}: #{value}"
210
+ end
211
+
192
212
  def ruby_instance_method_names
193
- @_ruby_instance_method_names ||= instance.class.instance_methods(false).sort
213
+ @ruby_instance_method_names ||= instance.class.instance_methods(false).sort
214
+ end
215
+
216
+ def ruby_private_method_names
217
+ @ruby_private_method_names ||= instance.private_methods(false).sort
218
+ end
219
+
220
+ def ruby_private_methods
221
+ @ruby_private_methods ||= ruby_private_method_names.map { |method_name| instance.method(method_name) }
222
+ rescue StandardError => e
223
+ puts e
194
224
  end
195
225
 
196
226
  def ruby_instance_methods
197
- @_ruby_instance_methods ||= ruby_instance_method_names.map { |method_name| instance.method(method_name) }
227
+ @ruby_instance_methods ||= ruby_instance_method_names.map { |method_name| instance.method(method_name) }
198
228
  rescue StandardError => e
199
229
  puts e
200
230
  end