peeky 0.0.40 → 0.0.42
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/.rubocop.yml +1 -1
- data/README.md +4 -0
- data/lib/peeky/class_info.rb +47 -15
- data/lib/peeky/method_info.rb +4 -1
- data/lib/peeky/predicates/attr_reader_predicate.rb +6 -1
- data/lib/peeky/renderer/class_debug_render.rb +12 -4
- data/lib/peeky/renderer/class_interface_render.rb +10 -4
- data/lib/peeky/renderer/class_interface_yard_render.rb +49 -39
- data/lib/peeky/version.rb +1 -1
- data/lib/peeky.rb +6 -1
- metadata +2 -3
- data/lib/peeky/example/yard_sample.rb +0 -146
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 920d6f10ed0e11acad5844cc60e290ba9e7ee85e27e801cf766e6934e6e3ea06
|
|
4
|
+
data.tar.gz: 4637e61e368dba0a5c4a9c3e8b0e8ff058b11c939ea848040eeff4a71a15e627
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 56c35b423fb6b786a187548d9b9fe9a1d76f47da18dd6fb53eea1143593cbcfb6ff19de8f2ac5237193b6df7250726ef73d9e3c287655ded452331f99bca05f0
|
|
7
|
+
data.tar.gz: cd58b3be796b1e185a697ac3f6dca2836154750bf856b4455e4dbd6c7224d6b629e3bd3184dd67ebd0195b0293affbb3feadfc62f9032fb07948f0b1bfafa2c0
|
data/.rubocop.yml
CHANGED
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:
|
data/lib/peeky/class_info.rb
CHANGED
|
@@ -26,16 +26,20 @@ module Peeky
|
|
|
26
26
|
else
|
|
27
27
|
result.push kv('# of instance methods', '')
|
|
28
28
|
end
|
|
29
|
-
if defined?(@
|
|
29
|
+
if defined?(@signatures)
|
|
30
30
|
result.push kv('# of accessors', accessors.length)
|
|
31
31
|
result.push kv('# of readers', readers.length)
|
|
32
32
|
result.push kv('# of writers', writers.length)
|
|
33
|
-
result.push kv('# of methods',
|
|
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)
|
|
34
36
|
else
|
|
35
37
|
result.push kv('# of accessors', '')
|
|
36
38
|
result.push kv('# of readers', '')
|
|
37
39
|
result.push kv('# of writers', '')
|
|
38
40
|
result.push kv('# of methods', '')
|
|
41
|
+
result.push kv('# of methods - public', '')
|
|
42
|
+
result.push kv('# of methods - private', '')
|
|
39
43
|
end
|
|
40
44
|
result.join("\n")
|
|
41
45
|
end
|
|
@@ -50,7 +54,7 @@ module Peeky
|
|
|
50
54
|
# pre-load this information early.
|
|
51
55
|
def load
|
|
52
56
|
ruby_instance_methods
|
|
53
|
-
ruby_instance_method_names
|
|
57
|
+
# ruby_instance_method_names
|
|
54
58
|
signatures
|
|
55
59
|
end
|
|
56
60
|
|
|
@@ -61,19 +65,19 @@ module Peeky
|
|
|
61
65
|
|
|
62
66
|
# Class name
|
|
63
67
|
def class_name
|
|
64
|
-
@
|
|
68
|
+
@class_name ||= class_full_name.to_s.gsub(/^.*::/, '')
|
|
65
69
|
# instance.class.name.split('::').last
|
|
66
70
|
end
|
|
67
71
|
|
|
68
72
|
# Module name
|
|
69
73
|
def module_name
|
|
70
|
-
@
|
|
74
|
+
@module_name ||= class_full_name.to_s.gsub(/(.*)::.*/, '\1')
|
|
71
75
|
end
|
|
72
76
|
|
|
73
77
|
# Get a list of :attr_accessor on the class
|
|
74
78
|
# @return [Array<AttrInfo>] list of AttrInfo where type is :attr_accessor
|
|
75
79
|
def accessors
|
|
76
|
-
@
|
|
80
|
+
@accessors ||= attribute_infos.select { |attribute_info| attribute_info.type == :attr_accessor }
|
|
77
81
|
end
|
|
78
82
|
|
|
79
83
|
# Get a list of :attr_accessors ordered the way they are in the source code
|
|
@@ -86,7 +90,7 @@ module Peeky
|
|
|
86
90
|
|
|
87
91
|
# Attribute infos
|
|
88
92
|
def attribute_infos
|
|
89
|
-
@
|
|
93
|
+
@attribute_infos ||= begin
|
|
90
94
|
grouped_method_infos = signatures.select { |signature| signature.readable? || signature.writable? }.group_by(&:clean_name)
|
|
91
95
|
|
|
92
96
|
grouped_method_infos.keys.map { |key| AttrInfo.create(*grouped_method_infos[key]) }
|
|
@@ -102,8 +106,20 @@ module Peeky
|
|
|
102
106
|
|
|
103
107
|
# Get a list methods
|
|
104
108
|
# @return [Array<MethodInfo>] list of MethodInfo where type is :method
|
|
105
|
-
def
|
|
106
|
-
@
|
|
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 }
|
|
107
123
|
end
|
|
108
124
|
|
|
109
125
|
# Get a list methods ordered the way they are in the source code
|
|
@@ -111,7 +127,7 @@ module Peeky
|
|
|
111
127
|
def methods_source_order
|
|
112
128
|
# TODO: This feature is required
|
|
113
129
|
# May be best to have a sort object that can be created for each type of ordering that is needed
|
|
114
|
-
|
|
130
|
+
all_methods
|
|
115
131
|
end
|
|
116
132
|
|
|
117
133
|
# Reader by name
|
|
@@ -124,7 +140,7 @@ module Peeky
|
|
|
124
140
|
# Get a list of :attr_reader on the class
|
|
125
141
|
# @return [Array<AttrInfo>] list of AttrInfo where type is :attr_accessor
|
|
126
142
|
def readers
|
|
127
|
-
@
|
|
143
|
+
@readers ||= attribute_infos.select { |attribute_info| attribute_info.type == :attr_reader }
|
|
128
144
|
end
|
|
129
145
|
|
|
130
146
|
# Get a list of :attr_reader ordered the way they are in the source code
|
|
@@ -138,7 +154,7 @@ module Peeky
|
|
|
138
154
|
# Get a list of :attr_writer on the class
|
|
139
155
|
# @return [Array<AttrInfo>] list of AttrInfo where type is :attr_writer
|
|
140
156
|
def writers
|
|
141
|
-
@
|
|
157
|
+
@writers ||= attribute_infos.select { |attribute_info| attribute_info.type == :attr_writer }
|
|
142
158
|
end
|
|
143
159
|
|
|
144
160
|
# Get a list of :attr_writer ordered the way they are in the source code
|
|
@@ -161,7 +177,13 @@ module Peeky
|
|
|
161
177
|
# such as static, private vs public
|
|
162
178
|
# deep, deep_to_level, this_instance.
|
|
163
179
|
def signatures
|
|
164
|
-
@
|
|
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
|
|
165
187
|
end
|
|
166
188
|
|
|
167
189
|
# Signatures by clean name
|
|
@@ -188,11 +210,21 @@ module Peeky
|
|
|
188
210
|
end
|
|
189
211
|
|
|
190
212
|
def ruby_instance_method_names
|
|
191
|
-
@
|
|
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
|
|
192
224
|
end
|
|
193
225
|
|
|
194
226
|
def ruby_instance_methods
|
|
195
|
-
@
|
|
227
|
+
@ruby_instance_methods ||= ruby_instance_method_names.map { |method_name| instance.method(method_name) }
|
|
196
228
|
rescue StandardError => e
|
|
197
229
|
puts e
|
|
198
230
|
end
|
data/lib/peeky/method_info.rb
CHANGED
|
@@ -14,6 +14,8 @@ module Peeky
|
|
|
14
14
|
# MethodInfo delegates to the underlying ruby method object
|
|
15
15
|
attr_reader :focal_method
|
|
16
16
|
|
|
17
|
+
attr_reader :access_control
|
|
18
|
+
|
|
17
19
|
def_delegators :focal_method, :name, :receiver, :arity, :super_method
|
|
18
20
|
|
|
19
21
|
## Stage 2 is the method likely to be an attribute reader or writer
|
|
@@ -23,9 +25,10 @@ module Peeky
|
|
|
23
25
|
# method in ruby, was it `def method` or `attr_reader` / `attr_writer`
|
|
24
26
|
attr_reader :implementation_type
|
|
25
27
|
|
|
26
|
-
def initialize(method, target_instance)
|
|
28
|
+
def initialize(method, target_instance, access_control: :public)
|
|
27
29
|
@focal_method = method
|
|
28
30
|
@target_instance = target_instance
|
|
31
|
+
@access_control = access_control
|
|
29
32
|
@parameters = ParameterInfo.from_method(method)
|
|
30
33
|
# stage 1
|
|
31
34
|
# @implementation_type = :method
|
|
@@ -32,7 +32,12 @@ module Peeky
|
|
|
32
32
|
cloned = instance.clone
|
|
33
33
|
|
|
34
34
|
cloned.instance_eval(code)
|
|
35
|
-
|
|
35
|
+
begin
|
|
36
|
+
current_value = cloned.send(method_name)
|
|
37
|
+
rescue StandardError #=> exception
|
|
38
|
+
current_value = nil
|
|
39
|
+
end
|
|
40
|
+
|
|
36
41
|
current_value == new_value
|
|
37
42
|
end
|
|
38
43
|
|
|
@@ -24,7 +24,7 @@ module Peeky
|
|
|
24
24
|
output.push('')
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
methods = render_methods
|
|
27
|
+
methods = render_methods(@class_info.public_methods)
|
|
28
28
|
|
|
29
29
|
if methods.length.positive?
|
|
30
30
|
output.push("-- Public Methods #{'-' * 82}")
|
|
@@ -32,6 +32,14 @@ module Peeky
|
|
|
32
32
|
output.push('')
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
+
methods = render_methods(@class_info.private_methods)
|
|
36
|
+
|
|
37
|
+
if methods.length.positive?
|
|
38
|
+
output.push("-- Private Methods #{'-' * 82}")
|
|
39
|
+
output.push(*methods)
|
|
40
|
+
output.push('')
|
|
41
|
+
end
|
|
42
|
+
|
|
35
43
|
output.pop if output.last == ''
|
|
36
44
|
|
|
37
45
|
output.join("\n")
|
|
@@ -70,10 +78,10 @@ module Peeky
|
|
|
70
78
|
@class_info.writers.map { |attr| kv('attr_writer', attr.name) }
|
|
71
79
|
end
|
|
72
80
|
|
|
73
|
-
def render_methods
|
|
74
|
-
|
|
81
|
+
def render_methods(method_list)
|
|
82
|
+
method_list.flat_map do |method|
|
|
75
83
|
[
|
|
76
|
-
"#{method.name}
|
|
84
|
+
"[ #{method.name} ]",
|
|
77
85
|
*render_paramaters(method.parameters),
|
|
78
86
|
''
|
|
79
87
|
]
|
|
@@ -38,15 +38,20 @@ module Peeky
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
# Render the class interface
|
|
41
|
+
# rubocop:disable Metrics/AbcSize
|
|
41
42
|
def render
|
|
42
43
|
@indent = ''
|
|
43
|
-
output
|
|
44
|
+
output = []
|
|
44
45
|
output.push render_start
|
|
45
46
|
@indent = ' '
|
|
46
47
|
output += render_accessors
|
|
47
48
|
output += render_readers
|
|
48
49
|
output += render_writers
|
|
49
|
-
output += render_methods
|
|
50
|
+
output += render_methods(@class_info.public_methods)
|
|
51
|
+
unless @class_info.private_methods.length.zero?
|
|
52
|
+
output += ["#{@indent}private", '']
|
|
53
|
+
output += render_methods(@class_info.private_methods)
|
|
54
|
+
end
|
|
50
55
|
output.pop if output.last == ''
|
|
51
56
|
|
|
52
57
|
@indent = ''
|
|
@@ -54,6 +59,7 @@ module Peeky
|
|
|
54
59
|
|
|
55
60
|
output.join("\n")
|
|
56
61
|
end
|
|
62
|
+
# rubocop:enable Metrics/AbcSize
|
|
57
63
|
|
|
58
64
|
private
|
|
59
65
|
|
|
@@ -79,8 +85,8 @@ module Peeky
|
|
|
79
85
|
result
|
|
80
86
|
end
|
|
81
87
|
|
|
82
|
-
def render_methods
|
|
83
|
-
result =
|
|
88
|
+
def render_methods(method_list)
|
|
89
|
+
result = method_list.map do |method_signature|
|
|
84
90
|
render_signature = Peeky::Renderer::MethodSignatureRender.new(method_signature)
|
|
85
91
|
"#{@indent}#{render_signature.render}"
|
|
86
92
|
end
|
|
@@ -88,51 +88,61 @@ module Peeky
|
|
|
88
88
|
result
|
|
89
89
|
end
|
|
90
90
|
|
|
91
|
-
# rubocop:disable
|
|
91
|
+
# rubocop:disable Metics/AbcSize
|
|
92
92
|
def render_methods
|
|
93
93
|
result = []
|
|
94
|
-
class_info.
|
|
95
|
-
result
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
case parameter.type
|
|
102
|
-
when :splat
|
|
103
|
-
result.push "#{@indent}# @param #{parameter.name} [Array<#{default_splat_param_type}>] *#{parameter.name} - list of #{parameter.name.to_s.humanize.downcase}"
|
|
104
|
-
when :double_splat
|
|
105
|
-
result.push "#{@indent}# @param #{parameter.name} [<key: value>...] **#{parameter.name} - list of key/values"
|
|
106
|
-
when :block
|
|
107
|
-
result.push "#{@indent}# @param #{parameter.name} [Block] &#{parameter.name}"
|
|
108
|
-
when :key_required
|
|
109
|
-
result.push "#{@indent}# @param #{parameter.name} [#{default_param_type}] #{parameter.name}: <value for #{parameter.name.to_s.humanize.downcase}> (required)"
|
|
110
|
-
when :key_optional
|
|
111
|
-
result.push "#{@indent}# @param #{parameter.name} [#{parameter.default_value_type}] #{parameter.name}: is optional, defaults to #{parameter.wrap_default_value('nil')}"
|
|
112
|
-
when :param_required
|
|
113
|
-
result.push "#{@indent}# @param #{parameter.name} [#{default_param_type}] #{parameter.name.to_s.humanize.downcase} (required)"
|
|
114
|
-
when :param_optional
|
|
115
|
-
result.push "#{@indent}# @param #{parameter.name} [#{parameter.default_value_type}] #{parameter.name} is optional, defaults to #{parameter.wrap_default_value('nil')}"
|
|
116
|
-
# result.push "#{@indent}# @param #{parameter.name} [#{default_param_type}] #{parameter.name.to_s.humanize.downcase} (optional)"
|
|
117
|
-
else
|
|
118
|
-
result.push "#{@indent}# @param #{parameter.name} [#{default_param_type}] #{parameter.name.to_s.humanize.downcase}"
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
if method_signature.name.to_s.end_with?('?')
|
|
123
|
-
result.push ''
|
|
124
|
-
result.push "#{@indent}# @return [Boolean] true when #{method_signature.name.to_s.humanize.downcase}"
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
render_signature = Peeky::Renderer::MethodSignatureRender.new(method_signature)
|
|
128
|
-
render_signature.indent = @indent
|
|
129
|
-
render_signature.style = :default
|
|
130
|
-
result.push render_signature.render
|
|
94
|
+
class_info.public_methods.map.with_index do |method_signature, index|
|
|
95
|
+
render_method(result, method_signature, index)
|
|
96
|
+
end
|
|
97
|
+
class_info.private_methods.map.with_index do |method_signature, index|
|
|
98
|
+
result.push "\n#{indent}private\n" if index.zero?
|
|
99
|
+
render_method(result, method_signature, index)
|
|
131
100
|
end
|
|
132
101
|
result.push '' unless result.length.zero?
|
|
133
102
|
result
|
|
134
103
|
end
|
|
135
|
-
# rubocop:enable
|
|
104
|
+
# rubocop:enable Metics/AbcSize
|
|
105
|
+
|
|
106
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
|
107
|
+
def render_method(result, method_signature, index)
|
|
108
|
+
result.push '' if index.positive?
|
|
109
|
+
result.push "#{@indent}# #{method_signature.name.to_s.humanize}"
|
|
110
|
+
|
|
111
|
+
method_signature.parameters.each_with_index do |parameter, param_index|
|
|
112
|
+
result.push "#{@indent}#" if param_index.zero?
|
|
113
|
+
|
|
114
|
+
case parameter.type
|
|
115
|
+
when :splat
|
|
116
|
+
result.push "#{@indent}# @param #{parameter.name} [Array<#{default_splat_param_type}>] *#{parameter.name} - list of #{parameter.name.to_s.humanize.downcase}"
|
|
117
|
+
when :double_splat
|
|
118
|
+
result.push "#{@indent}# @param #{parameter.name} [<key: value>...] **#{parameter.name} - list of key/values"
|
|
119
|
+
when :block
|
|
120
|
+
result.push "#{@indent}# @param #{parameter.name} [Block] &#{parameter.name}"
|
|
121
|
+
when :key_required
|
|
122
|
+
result.push "#{@indent}# @param #{parameter.name} [#{default_param_type}] #{parameter.name}: <value for #{parameter.name.to_s.humanize.downcase}> (required)"
|
|
123
|
+
when :key_optional
|
|
124
|
+
result.push "#{@indent}# @param #{parameter.name} [#{parameter.default_value_type}] #{parameter.name}: is optional, defaults to #{parameter.wrap_default_value('nil')}"
|
|
125
|
+
when :param_required
|
|
126
|
+
result.push "#{@indent}# @param #{parameter.name} [#{default_param_type}] #{parameter.name.to_s.humanize.downcase} (required)"
|
|
127
|
+
when :param_optional
|
|
128
|
+
result.push "#{@indent}# @param #{parameter.name} [#{parameter.default_value_type}] #{parameter.name} is optional, defaults to #{parameter.wrap_default_value('nil')}"
|
|
129
|
+
# result.push "#{@indent}# @param #{parameter.name} [#{default_param_type}] #{parameter.name.to_s.humanize.downcase} (optional)"
|
|
130
|
+
else
|
|
131
|
+
result.push "#{@indent}# @param #{parameter.name} [#{default_param_type}] #{parameter.name.to_s.humanize.downcase}"
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
if method_signature.name.to_s.end_with?('?')
|
|
136
|
+
result.push ''
|
|
137
|
+
result.push "#{@indent}# @return [Boolean] true when #{method_signature.name.to_s.humanize.downcase}"
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
render_signature = Peeky::Renderer::MethodSignatureRender.new(method_signature)
|
|
141
|
+
render_signature.indent = @indent
|
|
142
|
+
render_signature.style = :default
|
|
143
|
+
result.push render_signature.render
|
|
144
|
+
end
|
|
145
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
|
136
146
|
|
|
137
147
|
def render_end
|
|
138
148
|
"#{@indent}end"
|
data/lib/peeky/version.rb
CHANGED
data/lib/peeky.rb
CHANGED
|
@@ -24,4 +24,9 @@ module Peeky
|
|
|
24
24
|
# Your code goes here...
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
if ENV['KLUE_DEBUG']&.to_s&.downcase == 'true'
|
|
28
|
+
namespace = 'Peeky::Version'
|
|
29
|
+
file_path = $LOADED_FEATURES.find { |f| f.include?('peeky/version') }
|
|
30
|
+
version = Peeky::VERSION.ljust(9)
|
|
31
|
+
puts "#{namespace.ljust(35)} : #{version.ljust(9)} : #{file_path}"
|
|
32
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: peeky
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.42
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Cruwys
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-10-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -59,7 +59,6 @@ files:
|
|
|
59
59
|
- lib/peeky/api.rb
|
|
60
60
|
- lib/peeky/attr_info.rb
|
|
61
61
|
- lib/peeky/class_info.rb
|
|
62
|
-
- lib/peeky/example/yard_sample.rb
|
|
63
62
|
- lib/peeky/method_info.rb
|
|
64
63
|
- lib/peeky/parameter_info.rb
|
|
65
64
|
- lib/peeky/predicates/attr_reader_predicate.rb
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
module Peeky
|
|
2
|
-
module Example
|
|
3
|
-
# Yard sample
|
|
4
|
-
class YardSample
|
|
5
|
-
# A read write1
|
|
6
|
-
attr_accessor :a_read_write1
|
|
7
|
-
|
|
8
|
-
# A read write2
|
|
9
|
-
attr_accessor :a_read_write2
|
|
10
|
-
|
|
11
|
-
# A read write3
|
|
12
|
-
attr_accessor :a_read_write3
|
|
13
|
-
|
|
14
|
-
# B reader1
|
|
15
|
-
attr_reader :b_reader1
|
|
16
|
-
|
|
17
|
-
# B reader2
|
|
18
|
-
attr_reader :b_reader2
|
|
19
|
-
|
|
20
|
-
# E looks like an attr reader
|
|
21
|
-
attr_reader :e_looks_like_an_attr_reader
|
|
22
|
-
|
|
23
|
-
# C writer1
|
|
24
|
-
attr_writer :c_writer1
|
|
25
|
-
|
|
26
|
-
# C writer2
|
|
27
|
-
attr_writer :c_writer2
|
|
28
|
-
|
|
29
|
-
# Alpha sort1
|
|
30
|
-
def alpha_sort1
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# Alpha sort2
|
|
34
|
-
def alpha_sort2
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# D do something method
|
|
38
|
-
def d_do_something_method
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
# E method with required param
|
|
42
|
-
#
|
|
43
|
-
# @param first_name [String] first name (required)
|
|
44
|
-
def e_method_with_required_param(first_name)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
# F method with required param and optional param
|
|
48
|
-
#
|
|
49
|
-
# @param first_name [String] first name (required)
|
|
50
|
-
# @param last_name [String] last_name is optional, defaults to ''
|
|
51
|
-
def f_method_with_required_param_and_optional_param(first_name, last_name = '')
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
# G method with required param and two optional params
|
|
55
|
-
#
|
|
56
|
-
# @param first_name [String] first name (required)
|
|
57
|
-
# @param last_name [String] last_name is optional, defaults to ''
|
|
58
|
-
# @param age [Integer] age is optional, defaults to 21
|
|
59
|
-
def g_method_with_required_param_and_two_optional_params(first_name, last_name = '', age = 21)
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
# H list of optional parameters
|
|
63
|
-
#
|
|
64
|
-
# @param command_args [Array<Object>] *command_args - list of command args
|
|
65
|
-
def h_list_of_optional_parameters(*command_args)
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
# I method with two required params and list of optional params
|
|
69
|
-
#
|
|
70
|
-
# @param first_name [String] first name (required)
|
|
71
|
-
# @param last_name [String] last name (required)
|
|
72
|
-
# @param alias_names [Array<Object>] *alias_names - list of alias names
|
|
73
|
-
def i_method_with_two_required_params_and_list_of_optional_params(first_name, last_name, *alias_names)
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
# J method with list of named arguments
|
|
77
|
-
#
|
|
78
|
-
# @param options [<key: value>...] **options - list of key/values
|
|
79
|
-
def j_method_with_list_of_named_arguments(**options)
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
# Jin
|
|
83
|
-
#
|
|
84
|
-
# @param aaa [String] aaa (required)
|
|
85
|
-
def jin(aaa)
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
# K method with block
|
|
89
|
-
#
|
|
90
|
-
# @param code_block [Block] &code_block
|
|
91
|
-
def k_method_with_block(&code_block)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
# L method with key value param required
|
|
95
|
-
#
|
|
96
|
-
# @param name [String] name: <value for name> (required)
|
|
97
|
-
def l_method_with_key_value_param_required(name:)
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
# N method with key value param required and optional key value
|
|
101
|
-
#
|
|
102
|
-
# @param last_name [String] last_name: <value for last name> (required)
|
|
103
|
-
# @param salutation [String] salutation: is optional, defaults to 'Mr'
|
|
104
|
-
def n_method_with_key_value_param_required_and_optional_key_value(last_name:, salutation: 'Mr')
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
# P available?
|
|
108
|
-
|
|
109
|
-
# @return [Boolean] true when p available?
|
|
110
|
-
def p_available?
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
# Q danger will robinson!
|
|
114
|
-
def q_danger_will_robinson!
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
# Z complex
|
|
118
|
-
#
|
|
119
|
-
# @param aaa [String] aaa (required)
|
|
120
|
-
# @param bbb [Integer] bbb is optional, defaults to 1
|
|
121
|
-
# @param ccc [Array<Object>] *ccc - list of ccc
|
|
122
|
-
# @param ddd [String] ddd: <value for ddd> (required)
|
|
123
|
-
# @param eee [Integer] eee: is optional, defaults to 1
|
|
124
|
-
# @param fff [<key: value>...] **fff - list of key/values
|
|
125
|
-
# @param ggg [Block] &ggg
|
|
126
|
-
def z_complex(aaa, bbb = 1, *ccc, ddd:, eee: 1, **fff, &ggg)
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
# Z optional styles
|
|
130
|
-
#
|
|
131
|
-
# @param aaa [String] aaa (required)
|
|
132
|
-
# @param bbb [Integer] bbb is optional, defaults to 123
|
|
133
|
-
# @param ccc [String] ccc is optional, defaults to 'abc'
|
|
134
|
-
# @param ddd [TrueClass] ddd is optional, defaults to true
|
|
135
|
-
# @param eee [FalseClass] eee is optional, defaults to false
|
|
136
|
-
# @param fff [Object] fff is optional, defaults to nil
|
|
137
|
-
# @param ggg [Integer] ggg: is optional, defaults to 123
|
|
138
|
-
# @param hhh [String] hhh: is optional, defaults to 'xyz'
|
|
139
|
-
# @param iii [TrueClass] iii: is optional, defaults to true
|
|
140
|
-
# @param jjj [FalseClass] jjj: is optional, defaults to false
|
|
141
|
-
# @param kkk [Object] kkk: is optional, defaults to nil
|
|
142
|
-
def z_optional_styles(aaa, bbb = 123, ccc = 'abc', ddd = true, eee = false, fff = nil, ggg: 123, hhh: 'xyz', iii: true, jjj: false, kkk: )
|
|
143
|
-
end
|
|
144
|
-
end
|
|
145
|
-
end
|
|
146
|
-
end
|