peeky 0.0.27 → 0.0.40
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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +2 -3
- data/.rubocop.yml +8 -3
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile +15 -9
- data/Guardfile +4 -4
- data/README.md +96 -5
- data/Rakefile +15 -0
- data/{README-stories.md → STORIES.md} +11 -15
- data/USAGE.md +438 -0
- data/USAGE2.md +5 -0
- data/lib/peeky.rb +3 -0
- data/lib/peeky/api.rb +19 -2
- data/lib/peeky/attr_info.rb +4 -0
- data/lib/peeky/class_info.rb +40 -36
- data/lib/peeky/example/yard_sample.rb +33 -10
- data/lib/peeky/method_info.rb +106 -27
- data/lib/peeky/parameter_info.rb +102 -26
- data/lib/peeky/renderer/class_debug_render.rb +95 -0
- data/lib/peeky/renderer/class_interface_yard_render.rb +8 -8
- data/lib/peeky/renderer/method_call_minimum_params_render.rb +7 -3
- data/lib/peeky/version.rb +1 -1
- data/peeky.gemspec +11 -17
- metadata +19 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08eb3e66afafe6b6af1896abb030457b6bd417ddaed97311f174b30458805146'
|
4
|
+
data.tar.gz: 587f9afee745e58ee2783aa80d23c482a096ad8f96b8d50cbe9a1683b5f23188
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cf0854c592886fc801068f7bf3bb310bcbb8db1b343be375e1b4ad82ab574fba783697bdce642358747784a247ba4b1ee49885a6737662866568f1e550e71f8
|
7
|
+
data.tar.gz: 6a77ec688a91339da22a3f7c7c58e2ea7b9f8f7c99ec19e1998673484c4e197a2291d207c34fc42ab64d288055cc3b50e827a32659a39c1ee48aa7b758cb0e9c
|
data/.github/workflows/ruby.yml
CHANGED
@@ -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
|
-
|
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,4 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
+
TargetRubyVersion: 2.5
|
2
3
|
DisplayCopNames: true
|
3
4
|
ExtraDetails: true
|
4
5
|
NewCops: enable
|
@@ -7,9 +8,13 @@ AllCops:
|
|
7
8
|
- "lib/peeky/example/yard_sample.rb"
|
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
|
-
|
43
|
+
IgnoredMethods:
|
39
44
|
- configure
|
40
45
|
- context
|
41
46
|
- define
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|
55
55
|
## Enforcement
|
56
56
|
|
57
57
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at david
|
58
|
+
reported by contacting the project team at david@ideasmne.com.au. All
|
59
59
|
complaints will be reviewed and investigated and will result in a response that
|
60
60
|
is deemed necessary and appropriate to the circumstances. The project team is
|
61
61
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
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
|
-
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
|
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
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
@@ -30,17 +30,108 @@ gem install peeky
|
|
30
30
|
|
31
31
|
As a Ruby Developer, I should be able to Reverse engineer classes and methods, so that I can document and understand them
|
32
32
|
|
33
|
-
See all [stories](./
|
33
|
+
See all [stories](./STORIES.md)
|
34
34
|
|
35
35
|
### Featured Stories
|
36
36
|
|
37
37
|
- As a Developer, I should be able to interrogate class instance information, so that I can reverse engineer a ruby class
|
38
|
-
- As a Developer, I can render method with minimal parameter calls, So that I know the minimum parameters when calling a method
|
38
|
+
- As a Developer, I can render a method with minimal parameter calls, So that I know the minimum parameters when calling a method
|
39
39
|
- As a Developer, I can render a class with instance attributes and methods, So that I can quickly mock out an entire class
|
40
40
|
|
41
41
|
## Usage
|
42
42
|
|
43
|
-
|
43
|
+
See all [usage examples](./USAGE.md)
|
44
|
+
|
45
|
+
### Basic Example
|
46
|
+
|
47
|
+
This example assumes you have this simple class
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
module Sample
|
53
|
+
class SimpleClass
|
54
|
+
attr_accessor :read_write
|
55
|
+
|
56
|
+
def position_and_optional(aaa, bbb = 1)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
62
|
+
|
63
|
+
### Rendering Examples
|
64
|
+
|
65
|
+
Here a list of example renderers for the simple class
|
66
|
+
|
67
|
+
#### Class interface
|
68
|
+
Render simple class using class_interface renderer with compact formatting
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
puts api.render_class(:class_interface, instance: Sample::SimpleClass.new)
|
72
|
+
```
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
class SimpleClass
|
78
|
+
attr_accessor :read_write
|
79
|
+
|
80
|
+
def position_and_optional(aaa, bbb = nil); end
|
81
|
+
end
|
82
|
+
```
|
83
|
+
|
84
|
+
#### Documented class interface
|
85
|
+
Render simple class using class_interface_yard renderer to product YARD compatible documentation
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
puts api.render_class(:class_interface_yard, instance: Sample::SimpleClass.new)
|
89
|
+
```
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
class SimpleClass
|
95
|
+
# Read write
|
96
|
+
attr_accessor :read_write
|
97
|
+
|
98
|
+
# Position and optional
|
99
|
+
#
|
100
|
+
# @param aaa [String] aaa (required)
|
101
|
+
# @param bbb [String] bbb (optional)
|
102
|
+
def position_and_optional(aaa, bbb = nil)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
```
|
106
|
+
|
107
|
+
#### Class debug
|
108
|
+
Render debug information
|
109
|
+
|
110
|
+
```ruby
|
111
|
+
puts api.render_class(:class_debug, instance: Sample::SimpleClass.new)
|
112
|
+
```
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
```text
|
117
|
+
----------------------------------------------------------------------
|
118
|
+
class name : SimpleClass
|
119
|
+
module name : Sample
|
120
|
+
class full name : Sample::SimpleClass
|
121
|
+
|
122
|
+
-- Attributes --------------------------------------------------------
|
123
|
+
attr_accessor : read_write
|
124
|
+
|
125
|
+
-- Public Methods ----------------------------------------------------
|
126
|
+
position_and_optional::
|
127
|
+
name param format type
|
128
|
+
----------------------------------------------------------------------
|
129
|
+
aaa aaa param_required
|
130
|
+
bbb bbb = nil param_optional
|
131
|
+
```
|
132
|
+
|
133
|
+
|
134
|
+
|
44
135
|
|
45
136
|
## Development
|
46
137
|
|
@@ -50,7 +141,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
50
141
|
|
51
142
|
## Contributing
|
52
143
|
|
53
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
144
|
+
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.
|
54
145
|
|
55
146
|
## License
|
56
147
|
|
@@ -58,7 +149,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
58
149
|
|
59
150
|
## Code of Conduct
|
60
151
|
|
61
|
-
Everyone interacting in the Peeky project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the.
|
152
|
+
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).
|
62
153
|
|
63
154
|
## Copyright
|
64
155
|
|
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]
|
@@ -4,17 +4,12 @@
|
|
4
4
|
|
5
5
|
As a Ruby Developer, I should be able to Reverse engineer classes and methods, so that I can document and understand them
|
6
6
|
|
7
|
-
## Development
|
7
|
+
## Development radar
|
8
8
|
|
9
9
|
|
10
10
|
### Tasks next on list
|
11
11
|
|
12
|
-
As a Developer, I can
|
13
|
-
|
14
|
-
- Add simplified API with examples
|
15
|
-
- Start documenting usage instructions
|
16
|
-
|
17
|
-
As a Developer, I can use Peeky with a simple API, so that I use this GEM quickly
|
12
|
+
As a Developer, I can use Peeky with a simple API, so that I use Peeky quickly
|
18
13
|
|
19
14
|
- Add simplified API with examples
|
20
15
|
- Start documenting usage instructions
|
@@ -30,12 +25,6 @@ As a Developer, I can quickly build requirements, so that I can document project
|
|
30
25
|
|
31
26
|
### Stories - completed
|
32
27
|
|
33
|
-
As a David, I can edify Karin, because she is cool
|
34
|
-
|
35
|
-
- karin_is_awesome
|
36
|
-
- i_am_very_grateful_for_karin
|
37
|
-
- karin_the_beautiful
|
38
|
-
|
39
28
|
As a Developer, I can render a class with instance attributes and methods, So that I can quickly mock out an entire class
|
40
29
|
|
41
30
|
- Render: Class Interface
|
@@ -48,7 +37,7 @@ As a Developer, I can see the method signature of a method, So that I understand
|
|
48
37
|
|
49
38
|
- Render: Method Signature in compact format
|
50
39
|
|
51
|
-
As a Developer, I can render method with minimal parameter calls, So that I know the minimum parameters when calling a method
|
40
|
+
As a Developer, I can render a method with minimal parameter calls, So that I know the minimum parameters when calling a method
|
52
41
|
|
53
42
|
- Render: Simple instance method calls with minimum parameters
|
54
43
|
|
@@ -65,7 +54,14 @@ As a Developer, I should be able to interrogate class instance information, so t
|
|
65
54
|
- ClassInfo stores information about a ruby class. Only support instance methods
|
66
55
|
|
67
56
|
|
68
|
-
|
57
|
+
### Tasks - completed
|
58
|
+
|
59
|
+
As a Developer, I can render a class with RDoc documentation, so that I do not have to manually type RDoc references
|
60
|
+
|
61
|
+
|
62
|
+
As a Developer, I can read detailed API documentation on Peaky, so that I use Peeky quickly
|
63
|
+
|
64
|
+
- Acid Test: Use the YARD renderer to document Peaky the GEM
|
69
65
|
|
70
66
|
Setup GitHub Action (test and lint)
|
71
67
|
|
data/USAGE.md
ADDED
@@ -0,0 +1,438 @@
|
|
1
|
+
# Peeky
|
2
|
+
|
3
|
+
> Peeky is a Ruby GEM for peaking into ruby classes and extracting meta
|
4
|
+
|
5
|
+
As a Ruby Developer, I should be able to Reverse engineer classes and methods, so that I can document and understand them
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
### Sample Classes
|
10
|
+
|
11
|
+
The usage examples listed below will work with these sample classes
|
12
|
+
|
13
|
+
#### Simple example
|
14
|
+
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
module Sample
|
18
|
+
class SimpleClass
|
19
|
+
attr_accessor :read_write
|
20
|
+
|
21
|
+
def position_and_optional(aaa, bbb = 1)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
```
|
26
|
+
|
27
|
+
#### Complex example
|
28
|
+
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
module Sample
|
32
|
+
class ComplexClass
|
33
|
+
attr_accessor :a_read_write1, :a_read_write2
|
34
|
+
attr_reader :b_reader, :b_another_reader
|
35
|
+
attr_writer :c_writer, :c_another_writer
|
36
|
+
|
37
|
+
def do_something_method
|
38
|
+
end
|
39
|
+
|
40
|
+
def looks_like_an_attr_reader
|
41
|
+
@looks_like_an_attr_reader ||= 5
|
42
|
+
end
|
43
|
+
|
44
|
+
def method_01(aaa); end
|
45
|
+
|
46
|
+
def method_02(aaa, bbb = 1); end
|
47
|
+
|
48
|
+
def method_03(aaa, bbb = 1, ccc = 2); end
|
49
|
+
|
50
|
+
def method_04(*aaa); end
|
51
|
+
|
52
|
+
def method_05(aaa, bbb = 1, *ccc); end
|
53
|
+
|
54
|
+
def method_06(**aaa); end
|
55
|
+
|
56
|
+
def method_07(aaa, *bbb, **ccc); end
|
57
|
+
|
58
|
+
def method_08(aaa, *bbb, **ccc, &ddd); end
|
59
|
+
|
60
|
+
def method_09(aaa:); end
|
61
|
+
|
62
|
+
def method_10(aaa:, bbb: 1); end
|
63
|
+
|
64
|
+
def questionable?; end
|
65
|
+
|
66
|
+
def destructive!; end
|
67
|
+
|
68
|
+
def method_with_every_type_of_paramater(aaa, bbb = 1, *ccc, ddd:, eee: 1, **fff, &ggg); end
|
69
|
+
|
70
|
+
# Check that methods are sorted
|
71
|
+
def alpha_sort2; end
|
72
|
+
def alpha_sort1; end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
```
|
76
|
+
|
77
|
+
|
78
|
+
### Build Class Information
|
79
|
+
|
80
|
+
Use build_class_info to extract meta data from a ruby class
|
81
|
+
|
82
|
+
#### Build ClassInfo
|
83
|
+
By default information is lazy loaded only when accessed
|
84
|
+
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
class_info = api.build_class_info(Sample::SimpleClass.new)
|
88
|
+
|
89
|
+
puts class_info
|
90
|
+
```
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
```shell
|
95
|
+
Sample::SimpleClass
|
96
|
+
```
|
97
|
+
|
98
|
+
#### Build ClassInfo - pre-loaded
|
99
|
+
Pre-load will ensure that methods and parameters are loaded straight away.
|
100
|
+
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
class_info = api.build_class_info(Sample::ComplexClass.new, lazy: false)
|
104
|
+
|
105
|
+
puts class_info
|
106
|
+
```
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
```shell
|
111
|
+
Sample::ComplexClass
|
112
|
+
```
|
113
|
+
|
114
|
+
|
115
|
+
### Render Class
|
116
|
+
|
117
|
+
Render a class using a pre-defined class renderer that can be referenced by key
|
118
|
+
|
119
|
+
#### Render class interface using class_info
|
120
|
+
Render a basic class interface in compact format "One line per method".
|
121
|
+
|
122
|
+
Note: Modules are not yet supported in Peeky
|
123
|
+
|
124
|
+
|
125
|
+
```ruby
|
126
|
+
class_info = api.build_class_info(Sample::SimpleClass.new)
|
127
|
+
|
128
|
+
puts api.render_class(:class_interface, class_info: class_info)
|
129
|
+
```
|
130
|
+
|
131
|
+
#### Render class interface using an instance of the intended class
|
132
|
+
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
puts api.render_class(:class_interface, instance: Sample::SimpleClass.new)
|
136
|
+
```
|
137
|
+
|
138
|
+
|
139
|
+
### Render Class Examples
|
140
|
+
|
141
|
+
Here a list of example renderers for the complex class
|
142
|
+
|
143
|
+
#### Class interface
|
144
|
+
Render simple class using class_interface renderer
|
145
|
+
|
146
|
+
```ruby
|
147
|
+
puts api.render_class(:class_interface, instance: Sample::SimpleClass.new)
|
148
|
+
```
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
```ruby
|
153
|
+
class ComplexClass
|
154
|
+
attr_accessor :a_read_write1
|
155
|
+
attr_accessor :a_read_write2
|
156
|
+
|
157
|
+
attr_reader :b_another_reader
|
158
|
+
attr_reader :b_reader
|
159
|
+
attr_reader :looks_like_an_attr_reader
|
160
|
+
|
161
|
+
attr_writer :c_another_writer
|
162
|
+
attr_writer :c_writer
|
163
|
+
|
164
|
+
def alpha_sort1; end
|
165
|
+
def alpha_sort2; end
|
166
|
+
def destructive!; end
|
167
|
+
def do_something_method; end
|
168
|
+
def method_01(aaa); end
|
169
|
+
def method_02(aaa, bbb = nil); end
|
170
|
+
def method_03(aaa, bbb = nil, ccc = nil); end
|
171
|
+
def method_04(*aaa); end
|
172
|
+
def method_05(aaa, bbb = nil, *ccc); end
|
173
|
+
def method_06(**aaa); end
|
174
|
+
def method_07(aaa, *bbb, **ccc); end
|
175
|
+
def method_08(aaa, *bbb, **ccc, &ddd); end
|
176
|
+
def method_09(aaa:); end
|
177
|
+
def method_10(aaa:, bbb: nil); end
|
178
|
+
def method_with_every_type_of_paramater(aaa, bbb = nil, *ccc, ddd:, eee: nil, **fff, &ggg);end
|
179
|
+
def questionable?; end
|
180
|
+
end
|
181
|
+
```
|
182
|
+
|
183
|
+
#### Class interface - YARD
|
184
|
+
Render complex class using class_interface_yard renderer
|
185
|
+
|
186
|
+
```ruby
|
187
|
+
puts api.render_class(:class_interface_yard, instance: Sample::ComplexClass.new)
|
188
|
+
```
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
```ruby
|
193
|
+
class ComplexClass
|
194
|
+
# A read write1
|
195
|
+
attr_accessor :a_read_write1
|
196
|
+
|
197
|
+
# A read write2
|
198
|
+
attr_accessor :a_read_write2
|
199
|
+
|
200
|
+
# B another reader
|
201
|
+
attr_reader :b_another_reader
|
202
|
+
|
203
|
+
# B reader
|
204
|
+
attr_reader :b_reader
|
205
|
+
|
206
|
+
# Looks like an attr reader
|
207
|
+
attr_reader :looks_like_an_attr_reader
|
208
|
+
|
209
|
+
# C another writer
|
210
|
+
attr_writer :c_another_writer
|
211
|
+
|
212
|
+
# C writer
|
213
|
+
attr_writer :c_writer
|
214
|
+
|
215
|
+
# Alpha sort1
|
216
|
+
def alpha_sort1
|
217
|
+
end
|
218
|
+
|
219
|
+
# Alpha sort2
|
220
|
+
def alpha_sort2
|
221
|
+
end
|
222
|
+
|
223
|
+
# Destructive!
|
224
|
+
def destructive!
|
225
|
+
end
|
226
|
+
|
227
|
+
# Do something method
|
228
|
+
def do_something_method
|
229
|
+
end
|
230
|
+
|
231
|
+
# Method 01
|
232
|
+
#
|
233
|
+
# @param aaa [String] aaa (required)
|
234
|
+
def method_01(aaa)
|
235
|
+
end
|
236
|
+
|
237
|
+
# Method 02
|
238
|
+
#
|
239
|
+
# @param aaa [String] aaa (required)
|
240
|
+
# @param bbb [String] bbb (optional)
|
241
|
+
def method_02(aaa, bbb = nil)
|
242
|
+
end
|
243
|
+
|
244
|
+
# Method 03
|
245
|
+
#
|
246
|
+
# @param aaa [String] aaa (required)
|
247
|
+
# @param bbb [String] bbb (optional)
|
248
|
+
# @param ccc [String] ccc (optional)
|
249
|
+
def method_03(aaa, bbb = nil, ccc = nil)
|
250
|
+
end
|
251
|
+
|
252
|
+
# Method 04
|
253
|
+
#
|
254
|
+
# @param aaa [Array<Object>] *aaa - list of aaa
|
255
|
+
def method_04(*aaa)
|
256
|
+
end
|
257
|
+
|
258
|
+
# Method 05
|
259
|
+
#
|
260
|
+
# @param aaa [String] aaa (required)
|
261
|
+
# @param bbb [String] bbb (optional)
|
262
|
+
# @param ccc [Array<Object>] *ccc - list of ccc
|
263
|
+
def method_05(aaa, bbb = nil, *ccc)
|
264
|
+
end
|
265
|
+
|
266
|
+
# Method 06
|
267
|
+
#
|
268
|
+
# @param aaa [<key: value>...] **aaa - list of key/values
|
269
|
+
def method_06(**aaa)
|
270
|
+
end
|
271
|
+
|
272
|
+
# Method 07
|
273
|
+
#
|
274
|
+
# @param aaa [String] aaa (required)
|
275
|
+
# @param bbb [Array<Object>] *bbb - list of bbb
|
276
|
+
# @param ccc [<key: value>...] **ccc - list of key/values
|
277
|
+
def method_07(aaa, *bbb, **ccc)
|
278
|
+
end
|
279
|
+
|
280
|
+
# Method 08
|
281
|
+
#
|
282
|
+
# @param aaa [String] aaa (required)
|
283
|
+
# @param bbb [Array<Object>] *bbb - list of bbb
|
284
|
+
# @param ccc [<key: value>...] **ccc - list of key/values
|
285
|
+
# @param ddd [Block] &ddd
|
286
|
+
def method_08(aaa, *bbb, **ccc, &ddd)
|
287
|
+
end
|
288
|
+
|
289
|
+
# Method 09
|
290
|
+
#
|
291
|
+
# @param aaa [String] aaa: <value for aaa> (required)
|
292
|
+
def method_09(aaa:)
|
293
|
+
end
|
294
|
+
|
295
|
+
# Method 10
|
296
|
+
#
|
297
|
+
# @param aaa [String] aaa: <value for aaa> (required)
|
298
|
+
# @param bbb [String] bbb: <value for bbb> (optional)
|
299
|
+
def method_10(aaa:, bbb: nil)
|
300
|
+
end
|
301
|
+
|
302
|
+
# Method with every type of paramater
|
303
|
+
#
|
304
|
+
# @param aaa [String] aaa (required)
|
305
|
+
# @param bbb [String] bbb (optional)
|
306
|
+
# @param ccc [Array<Object>] *ccc - list of ccc
|
307
|
+
# @param ddd [String] ddd: <value for ddd> (required)
|
308
|
+
# @param eee [String] eee: <value for eee> (optional)
|
309
|
+
# @param fff [<key: value>...] **fff - list of key/values
|
310
|
+
# @param ggg [Block] &ggg
|
311
|
+
def method_with_every_type_of_paramater(aaa, bbb = nil, *ccc, ddd:, eee: nil, **fff, &ggg)
|
312
|
+
end
|
313
|
+
|
314
|
+
# Questionable?
|
315
|
+
#
|
316
|
+
# @return [Boolean] true when questionable?
|
317
|
+
def questionable?
|
318
|
+
end
|
319
|
+
end
|
320
|
+
```
|
321
|
+
|
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
|
+
```
|