yard 0.9.27 → 0.9.35
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of yard might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +67 -9
- data/LEGAL +29 -1
- data/LICENSE +1 -1
- data/docs/WhatsNew.md +2 -2
- data/lib/yard/autoload.rb +2 -1
- data/lib/yard/cli/command.rb +1 -1
- data/lib/yard/cli/stats.rb +2 -1
- data/lib/yard/cli/yardoc.rb +3 -2
- data/lib/yard/code_objects/base.rb +5 -1
- data/lib/yard/config.rb +5 -1
- data/lib/yard/docstring_parser.rb +1 -1
- data/lib/yard/handlers/ruby/attribute_handler.rb +1 -1
- data/lib/yard/handlers/ruby/legacy/attribute_handler.rb +1 -1
- data/lib/yard/handlers/ruby/method_handler.rb +1 -1
- data/lib/yard/handlers/ruby/mixin_handler.rb +13 -6
- data/lib/yard/i18n/locale.rb +1 -1
- data/lib/yard/i18n/message.rb +2 -2
- data/lib/yard/i18n/messages.rb +1 -1
- data/lib/yard/i18n/pot_generator.rb +1 -1
- data/lib/yard/options.rb +1 -1
- data/lib/yard/parser/ruby/ast_node.rb +7 -0
- data/lib/yard/parser/ruby/ruby_parser.rb +8 -2
- data/lib/yard/parser/source_parser.rb +2 -3
- data/lib/yard/registry_resolver.rb +2 -1
- data/lib/yard/server/commands/base.rb +1 -1
- data/lib/yard/server/commands/library_command.rb +8 -8
- data/lib/yard/server/commands/static_file_helpers.rb +1 -2
- data/lib/yard/server/http_utils.rb +512 -0
- data/lib/yard/server/rack_adapter.rb +13 -5
- data/lib/yard/tags/tag.rb +2 -2
- data/lib/yard/tags/types_explainer.rb +1 -1
- data/lib/yard/templates/helpers/html_helper.rb +1 -1
- data/lib/yard/templates/helpers/method_helper.rb +3 -1
- data/lib/yard/templates/template.rb +3 -1
- data/lib/yard/version.rb +1 -1
- data/lib/yard.rb +3 -0
- data/po/ja.po +19 -19
- data/templates/default/fulldoc/html/frames.erb +3 -3
- data/templates/default/layout/html/footer.erb +1 -1
- data/templates/default/tags/html/option.erb +1 -1
- metadata +5 -55
- data/.dockerignore +0 -2
- data/.gitattributes +0 -4
- data/.github/FUNDING.yml +0 -3
- data/.github/ISSUE_TEMPLATE.md +0 -33
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -12
- data/.github/workflows/ci.yml +0 -30
- data/.github/workflows/gem.yml +0 -19
- data/.gitignore +0 -14
- data/.rspec +0 -2
- data/.rubocop.yml +0 -112
- data/CODE_OF_CONDUCT.md +0 -15
- data/CONTRIBUTING.md +0 -140
- data/Dockerfile.samus +0 -28
- data/Gemfile +0 -34
- data/Rakefile +0 -36
- data/SECURITY.md +0 -26
- data/benchmarks/builtins_vs_eval.rb +0 -24
- data/benchmarks/concat_vs_join.rb +0 -13
- data/benchmarks/erb_vs_erubis.rb +0 -54
- data/benchmarks/format_args.rb +0 -47
- data/benchmarks/generation.rb +0 -38
- data/benchmarks/marshal_vs_dbm.rb +0 -64
- data/benchmarks/parsing.rb +0 -46
- data/benchmarks/pathname_vs_string.rb +0 -51
- data/benchmarks/rdoc_vs_yardoc.rb +0 -11
- data/benchmarks/registry_store_types.rb +0 -49
- data/benchmarks/ri_vs_yri.rb +0 -19
- data/benchmarks/ripper_parser.rb +0 -13
- data/benchmarks/splat_vs_flatten.rb +0 -13
- data/benchmarks/template_erb.rb +0 -23
- data/benchmarks/template_format.rb +0 -7
- data/benchmarks/template_profile.rb +0 -18
- data/benchmarks/yri_cache.rb +0 -20
- data/samus.json +0 -49
- data/tasks/prepare_tag.rake +0 -45
- data/tasks/update_error_map.rake +0 -53
- data/yard.gemspec +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5ff0ce7fb0e2d8ecc443968bc650be669b354e264b468ed73110367f8e18a8f
|
4
|
+
data.tar.gz: 57f2052210346c9492bb9d80bd15200cc3410e358f4d169e09a148cd258fc65c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01c9c77f83fc7c2e8ccfe5cd21c16c51506ececa875a9e24793eb2d0d29376c69d8686f2ab8d0a11caefd77f5bf70424b40ea9e4c83d4afebd070b2c7c4d6132
|
7
|
+
data.tar.gz: d3e49a80ac5be583a158011351cbca068d4f78179ce02f88e43a3d02cac1a10ce7a02bd4b20fa9a44ce6dd519e02e2ede8acca8b5ed62a21341149de71c0a825
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,64 @@
|
|
1
1
|
# main
|
2
2
|
|
3
|
-
# 0.9.
|
3
|
+
# [0.9.35] - February 28th, 2024
|
4
|
+
|
5
|
+
[0.9.35]: https://github.com/lsegal/yard/compare/v0.9.34...v0.9.35
|
6
|
+
|
7
|
+
- Fix possible XSS on generated YARD frameset pages (thanks to @RedYetiDev for finding and patching) (2069e2b).
|
8
|
+
- Fix errors when using `@option` on non-method objects (#1508)
|
9
|
+
- Support Ruby 3.3 changes in Ripper parser (#1510)
|
10
|
+
|
11
|
+
# [0.9.34] - April 12nd, 2023
|
12
|
+
|
13
|
+
[0.9.34]: https://github.com/lsegal/yard/compare/v0.9.33...v0.9.34
|
14
|
+
|
15
|
+
- Add changelog to yard.gemspec
|
16
|
+
- Fix fork behavior in `yard server --fork`
|
17
|
+
|
18
|
+
# [0.9.33] - April 11st, 2023
|
19
|
+
|
20
|
+
[0.9.33]: https://github.com/lsegal/yard/compare/v0.9.32...v0.9.33
|
21
|
+
|
22
|
+
- Ensure .yardopts is present in gem package (internal YARD documentation change)
|
23
|
+
|
24
|
+
# 0.9.32 - April 9th, 2023
|
25
|
+
|
26
|
+
[0.9.32]: https://github.com/lsegal/yard/compare/v0.9.31...v0.9.32
|
27
|
+
|
28
|
+
- Fix issue with custom Rack::Request attributes in `yard server`
|
29
|
+
|
30
|
+
# [0.9.31] - April 9th, 2023
|
31
|
+
|
32
|
+
[0.9.31]: https://github.com/lsegal/yard/compare/v0.9.30...v0.9.31
|
33
|
+
|
34
|
+
- Remove dependency on webrick in YARD::Server::Commands::StaticFileHelpers
|
35
|
+
|
36
|
+
# [0.9.30] - April 9th, 2023
|
37
|
+
|
38
|
+
[0.9.30]: https://github.com/lsegal/yard/compare/v0.9.29...v0.9.30
|
39
|
+
|
40
|
+
- Hot release fix to correct issue with gem packaging missing templates (#1490)
|
41
|
+
|
42
|
+
# [0.9.29] - April 8th, 2023
|
43
|
+
|
44
|
+
[0.9.29]: https://github.com/lsegal/yard/compare/v0.9.28...v0.9.29
|
45
|
+
|
46
|
+
- Enable table support for CommonMarker (#1443)
|
47
|
+
- Parser performance improvements (#1452, #1453, #1454, #1455)
|
48
|
+
- Fix autoload of RipperParser (#1460)
|
49
|
+
- Remove dependency on webrick for better Ruby 3.1+ support
|
50
|
+
- Improvements for mixin resolution (#1467, #1468)
|
51
|
+
|
52
|
+
# [0.9.28] - June 1st, 2022
|
53
|
+
|
54
|
+
[0.9.28]: https://github.com/lsegal/yard/compare/v0.9.27...v0.9.28
|
55
|
+
|
56
|
+
- Safe load config YAML files (#1385)
|
57
|
+
- Handle empty string constants (#1415)
|
58
|
+
- Pre-emptively support removal of `Object#taint` in Ruby 3.2 (#1419)
|
59
|
+
- Fix Ruby 3.1 forward args Ripper change (#1431)
|
60
|
+
|
61
|
+
# [0.9.27] - November 29th, 2021
|
4
62
|
|
5
63
|
[0.9.27]: https://github.com/lsegal/yard/compare/v0.9.26...v0.9.27
|
6
64
|
|
@@ -16,14 +74,14 @@
|
|
16
74
|
- Fix `@!scope` maintaining state in lone comment blocks (#1411)
|
17
75
|
- Remove support for Travis CI
|
18
76
|
|
19
|
-
# 0.9.26 - December 26th, 2020
|
77
|
+
# [0.9.26] - December 26th, 2020
|
20
78
|
|
21
79
|
[0.9.26]: https://github.com/lsegal/yard/compare/v0.9.25...v0.9.26
|
22
80
|
|
23
81
|
- Add support for Ruby 3.0 and fix tests
|
24
82
|
- Fix support for `frozen_string_literal: false` magic comments (#1363)
|
25
83
|
|
26
|
-
# 0.9.25 - May 3rd, 2020
|
84
|
+
# [0.9.25] - May 3rd, 2020
|
27
85
|
|
28
86
|
[0.9.25]: https://github.com/lsegal/yard/compare/v0.9.24...v0.9.25
|
29
87
|
|
@@ -38,7 +96,7 @@
|
|
38
96
|
- Omit spec files in gem package (#1307)
|
39
97
|
- README updates (#1322)
|
40
98
|
|
41
|
-
# 0.9.24 - January 8th, 2020
|
99
|
+
# [0.9.24] - January 8th, 2020
|
42
100
|
|
43
101
|
[0.9.24]: https://github.com/lsegal/yard/compare/v0.9.23...v0.9.24
|
44
102
|
|
@@ -46,20 +104,20 @@
|
|
46
104
|
cache is changed.
|
47
105
|
- Fix issue where Registry fails to resolve first-time lookups on instance methods.
|
48
106
|
|
49
|
-
# 0.9.23 - January 5th, 2020
|
107
|
+
# [0.9.23] - January 5th, 2020
|
50
108
|
|
51
109
|
[0.9.23]: https://github.com/lsegal/yard/compare/v0.9.22...v0.9.23
|
52
110
|
|
53
111
|
- Fix issues with double encoded code blocks when highlighted from an extra
|
54
112
|
file.
|
55
113
|
|
56
|
-
# 0.9.22 - December 31st, 2019
|
114
|
+
# [0.9.22] - December 31st, 2019
|
57
115
|
|
58
116
|
[0.9.22]: https://github.com/lsegal/yard/compare/v0.9.21...v0.9.22
|
59
117
|
|
60
118
|
- Revert jquery update in last release since it requires more changes. (#1298)
|
61
119
|
|
62
|
-
# 0.9.21 - December 31st, 2019
|
120
|
+
# [0.9.21] - December 31st, 2019
|
63
121
|
|
64
122
|
[0.9.21]: https://github.com/lsegal/yard/compare/v0.9.20...v0.9.21
|
65
123
|
|
@@ -75,7 +133,7 @@
|
|
75
133
|
- Update jquery to 3.4.1 (#1294)
|
76
134
|
- Test fixes (#1244)
|
77
135
|
|
78
|
-
# 0.9.20 - June 27th, 2019
|
136
|
+
# [0.9.20] - June 27th, 2019
|
79
137
|
|
80
138
|
[0.9.20]: https://github.com/lsegal/yard/compare/v0.9.19...v0.9.20
|
81
139
|
|
@@ -85,7 +143,7 @@
|
|
85
143
|
`yard server` host under certain conditions. Thanks to CuongMX from
|
86
144
|
Viettel Cyber Security for discovering this vulnerability.
|
87
145
|
|
88
|
-
# 0.9.19 - April 2nd, 2019
|
146
|
+
# [0.9.19] - April 2nd, 2019
|
89
147
|
|
90
148
|
[0.9.19]: https://github.com/lsegal/yard/compare/v0.9.16...v0.9.19
|
91
149
|
|
data/LEGAL
CHANGED
@@ -4,7 +4,7 @@ LEGAL NOTICE INFORMATION
|
|
4
4
|
All the files in this distribution are covered under either the MIT
|
5
5
|
license (see the file LICENSE) except some files mentioned below.
|
6
6
|
|
7
|
-
lib/parser/ruby/legacy/ruby_lex.rb:
|
7
|
+
lib/yard/parser/ruby/legacy/ruby_lex.rb:
|
8
8
|
|
9
9
|
This file is under the Ruby license. YARD uses a modified version of it.
|
10
10
|
|
@@ -64,3 +64,31 @@ lib/parser/ruby/legacy/ruby_lex.rb:
|
|
64
64
|
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
65
65
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
66
66
|
PURPOSE.
|
67
|
+
|
68
|
+
lib/yard/server/http_utils.rb:
|
69
|
+
|
70
|
+
This file is vendored and slightly modified from WEBrick because it was
|
71
|
+
removed from Ruby core in Ruby 3.x.
|
72
|
+
|
73
|
+
Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved.
|
74
|
+
|
75
|
+
Redistribution and use in source and binary forms, with or without
|
76
|
+
modification, are permitted provided that the following conditions
|
77
|
+
are met:
|
78
|
+
1. Redistributions of source code must retain the above copyright
|
79
|
+
notice, this list of conditions and the following disclaimer.
|
80
|
+
2. Redistributions in binary form must reproduce the above copyright
|
81
|
+
notice, this list of conditions and the following disclaimer in the
|
82
|
+
documentation and/or other materials provided with the distribution.
|
83
|
+
|
84
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
85
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
86
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
87
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
88
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
89
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
90
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
91
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
92
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
93
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
94
|
+
SUCH DAMAGE.
|
data/LICENSE
CHANGED
data/docs/WhatsNew.md
CHANGED
@@ -92,7 +92,7 @@ methods are defined dynamically and not associated with any code.
|
|
92
92
|
#### New `@!parse` directive to parse Ruby code
|
93
93
|
|
94
94
|
A new {tag:!parse} directive was added that allows a developer to have
|
95
|
-
YARD parse code that might not necessarily be
|
95
|
+
YARD parse code that might not necessarily be parsable in its original
|
96
96
|
form. This is useful when using `instance_eval` and other dynamic
|
97
97
|
meta-programming techniques to define methods or perform functionality.
|
98
98
|
For instance, a common case of the "self.included" callback in module
|
@@ -1204,7 +1204,7 @@ that is actually being employed. Here's an example:
|
|
1204
1204
|
# @overload def to_html(html, autolink = true)
|
1205
1205
|
# This docstring describes the specific overload only.
|
1206
1206
|
# @param [String] html the HTML
|
1207
|
-
# @param [Boolean] autolink whether or not to
|
1207
|
+
# @param [Boolean] autolink whether or not to automatically link
|
1208
1208
|
# URL references
|
1209
1209
|
# @overload def to_html(html, opts = {})
|
1210
1210
|
# @param [String] html the HTML
|
data/lib/yard/autoload.rb
CHANGED
@@ -170,7 +170,6 @@ module YARD
|
|
170
170
|
|
171
171
|
module Ruby # Ruby parsing components.
|
172
172
|
module Legacy # Handles Ruby parsing in Ruby 1.8.
|
173
|
-
autoload :RipperParser, __p('parser/ruby/legacy/ruby_parser')
|
174
173
|
autoload :RubyParser, __p('parser/ruby/legacy/ruby_parser')
|
175
174
|
autoload :RubyToken, __p('parser/ruby/legacy/ruby_lex')
|
176
175
|
autoload :Statement, __p('parser/ruby/legacy/statement')
|
@@ -180,6 +179,7 @@ module YARD
|
|
180
179
|
|
181
180
|
autoload :AstNode, __p('parser/ruby/ast_node')
|
182
181
|
autoload :RubyParser, __p('parser/ruby/ruby_parser')
|
182
|
+
autoload :RipperParser, __p('parser/ruby/ruby_parser')
|
183
183
|
autoload :TokenResolver, __p('parser/ruby/token_resolver')
|
184
184
|
end
|
185
185
|
|
@@ -236,6 +236,7 @@ module YARD
|
|
236
236
|
autoload :FinishRequest, __p('server/adapter')
|
237
237
|
autoload :LibraryVersion, __p('server/library_version')
|
238
238
|
autoload :NotFoundError, __p('server/adapter')
|
239
|
+
autoload :HTTPUtils, __p('server/http_utils')
|
239
240
|
autoload :RackAdapter, __p('server/rack_adapter')
|
240
241
|
autoload :RackMiddleware, __p('server/rack_adapter')
|
241
242
|
autoload :Router, __p('server/router')
|
data/lib/yard/cli/command.rb
CHANGED
data/lib/yard/cli/stats.rb
CHANGED
@@ -225,7 +225,8 @@ module YARD
|
|
225
225
|
end
|
226
226
|
|
227
227
|
opts.on('--query QUERY', "Only includes objects that match a specific query") do |query|
|
228
|
-
|
228
|
+
query.taint if query.respond_to?(:taint)
|
229
|
+
options[:verifier].add_expressions(query)
|
229
230
|
end
|
230
231
|
end
|
231
232
|
end
|
data/lib/yard/cli/yardoc.rb
CHANGED
@@ -334,7 +334,7 @@ module YARD
|
|
334
334
|
private
|
335
335
|
|
336
336
|
# Generates output for objects
|
337
|
-
# @param [Hash, nil] checksums if supplied, a list of
|
337
|
+
# @param [Hash, nil] checksums if supplied, a list of checksums for files.
|
338
338
|
# @return [void]
|
339
339
|
# @since 0.5.1
|
340
340
|
def run_generate(checksums)
|
@@ -650,7 +650,8 @@ module YARD
|
|
650
650
|
|
651
651
|
opts.on('--query QUERY', "Only show objects that match a specific query") do |query|
|
652
652
|
next if YARD::Config.options[:safe_mode]
|
653
|
-
|
653
|
+
query.taint if query.respond_to?(:taint)
|
654
|
+
options.verifier.add_expressions(query)
|
654
655
|
end
|
655
656
|
|
656
657
|
opts.on('--title TITLE', 'Add a specific title to HTML documents') do |title|
|
@@ -303,6 +303,7 @@ module YARD
|
|
303
303
|
# definitions with docstrings first.
|
304
304
|
#
|
305
305
|
# @return [String] a filename
|
306
|
+
# @return [nil] if there is no file associated with the object
|
306
307
|
def file
|
307
308
|
@files.first ? @files.first[0] : nil
|
308
309
|
end
|
@@ -434,7 +435,10 @@ module YARD
|
|
434
435
|
#
|
435
436
|
# @return [Symbol] the type of code object this represents
|
436
437
|
def type
|
437
|
-
self.class.name.split('::').last
|
438
|
+
obj_name = self.class.name.split('::').last
|
439
|
+
obj_name.gsub!(/Object$/, '')
|
440
|
+
obj_name.downcase!
|
441
|
+
obj_name.to_sym
|
438
442
|
end
|
439
443
|
|
440
444
|
# Represents the unique path of the object. The default implementation
|
data/lib/yard/config.rb
CHANGED
@@ -236,7 +236,11 @@ module YARD
|
|
236
236
|
def self.read_config_file
|
237
237
|
if File.file?(CONFIG_FILE)
|
238
238
|
require 'yaml'
|
239
|
-
YAML.
|
239
|
+
if YAML.respond_to?(:safe_load_file)
|
240
|
+
YAML.safe_load_file(CONFIG_FILE, permitted_classes: [SymbolHash, Symbol])
|
241
|
+
else
|
242
|
+
YAML.load_file(CONFIG_FILE)
|
243
|
+
end
|
240
244
|
else
|
241
245
|
{}
|
242
246
|
end
|
@@ -8,7 +8,7 @@ module YARD
|
|
8
8
|
#
|
9
9
|
# == Subclassing Notes
|
10
10
|
#
|
11
|
-
# The DocstringParser can be subclassed and
|
11
|
+
# The DocstringParser can be subclassed and substituted during parsing by
|
12
12
|
# setting the {Docstring.default_parser} attribute with the name of the
|
13
13
|
# subclass. This allows developers to change the way docstrings are
|
14
14
|
# parsed, allowing for completely different docstring syntaxes.
|
@@ -52,7 +52,7 @@ class YARD::Handlers::Ruby::AttributeHandler < YARD::Handlers::Ruby::Base
|
|
52
52
|
register(o)
|
53
53
|
o.docstring = doc if o.docstring.blank?(false)
|
54
54
|
|
55
|
-
#
|
55
|
+
# Register the object explicitly
|
56
56
|
namespace.attributes[scope][name][type] = o
|
57
57
|
else
|
58
58
|
obj = namespace.children.find {|other| other.name == meth.to_sym && other.scope == scope }
|
@@ -51,7 +51,7 @@ class YARD::Handlers::Ruby::Legacy::AttributeHandler < YARD::Handlers::Ruby::Leg
|
|
51
51
|
register(o)
|
52
52
|
o.docstring = doc if o.docstring.blank?(false)
|
53
53
|
|
54
|
-
#
|
54
|
+
# Register the object explicitly
|
55
55
|
namespace.attributes[scope][name][type] = o
|
56
56
|
else
|
57
57
|
obj = namespace.children.find {|other| other.name == meth.to_sym && other.scope == scope }
|
@@ -97,7 +97,7 @@ class YARD::Handlers::Ruby::MethodHandler < YARD::Handlers::Ruby::Base
|
|
97
97
|
params << ['**' + args.double_splat_param.source, nil]
|
98
98
|
end
|
99
99
|
|
100
|
-
params << ['&' + args.block_param.source, nil] if args.block_param
|
100
|
+
params << ['&' + args.block_param.source, nil] if args.block_param && !args.args_forward
|
101
101
|
|
102
102
|
params
|
103
103
|
end
|
@@ -26,22 +26,29 @@ class YARD::Handlers::Ruby::MixinHandler < YARD::Handlers::Ruby::Base
|
|
26
26
|
raise YARD::Parser::UndocumentableError unless mixin.ref?
|
27
27
|
raise YARD::Parser::UndocumentableError if mixin.first.type == :ident
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
obj = Proxy.new(namespace, obj.value, :module)
|
29
|
+
if mixin.type == :var_ref && mixin[0] == s(:kw, "self")
|
30
|
+
obj = namespace
|
32
31
|
else
|
33
|
-
obj = Proxy.new(namespace, mixin.source
|
32
|
+
case obj = Proxy.new(namespace, mixin.source)
|
33
|
+
when ConstantObject # If a constant is included, use its value as the real object
|
34
|
+
obj = Proxy.new(namespace, obj.value, :module)
|
35
|
+
else
|
36
|
+
obj = Proxy.new(namespace, mixin.source, :module)
|
37
|
+
end
|
34
38
|
end
|
35
39
|
|
36
40
|
rec = recipient(mixin)
|
37
|
-
return if rec.nil?
|
41
|
+
return if rec.nil?
|
42
|
+
|
43
|
+
ensure_loaded!(rec)
|
44
|
+
return if rec.mixins(scope).include?(obj)
|
38
45
|
|
39
46
|
shift = statement.method_name(true) == :include ? :unshift : :push
|
40
47
|
rec.mixins(scope).send(shift, obj)
|
41
48
|
end
|
42
49
|
|
43
50
|
def recipient(mixin)
|
44
|
-
if statement[0].type == :const_path_ref
|
51
|
+
if statement[0].type == :const_path_ref || statement[0].type == :top_const_ref
|
45
52
|
Proxy.new(namespace, statement[0].source)
|
46
53
|
elsif statement[0].type == :var_ref && statement[0][0] != s(:kw, "self")
|
47
54
|
statement[0][0].type == :const ?
|
data/lib/yard/i18n/locale.rb
CHANGED
@@ -57,7 +57,7 @@ module YARD
|
|
57
57
|
end
|
58
58
|
|
59
59
|
# @param [String] message the translation target message.
|
60
|
-
# @return [String] translated message. If
|
60
|
+
# @return [String] translated message. If translation isn't
|
61
61
|
# registered, the +message+ is returned.
|
62
62
|
def translate(message)
|
63
63
|
@messages[message] || message
|
data/lib/yard/i18n/message.rb
CHANGED
@@ -8,7 +8,7 @@ module YARD
|
|
8
8
|
#
|
9
9
|
# @since 0.8.1
|
10
10
|
class Message
|
11
|
-
# @return [String] the message ID of the
|
11
|
+
# @return [String] the message ID of the translation target message.
|
12
12
|
attr_reader :id
|
13
13
|
|
14
14
|
# @return [Set] the set of locations. Location is an array of
|
@@ -18,7 +18,7 @@ module YARD
|
|
18
18
|
# @return [Set] the set of comments for the messages.
|
19
19
|
attr_reader :comments
|
20
20
|
|
21
|
-
# Creates a
|
21
|
+
# Creates a translate target message for message ID +id+.
|
22
22
|
#
|
23
23
|
# @param [String] id the message ID of the translate target message.
|
24
24
|
def initialize(id)
|
data/lib/yard/i18n/messages.rb
CHANGED
@@ -28,7 +28,7 @@ module YARD
|
|
28
28
|
@messages[id]
|
29
29
|
end
|
30
30
|
|
31
|
-
# Registers a {Message}, the
|
31
|
+
# Registers a {Message}, the message ID of which is +id+. If
|
32
32
|
# corresponding +Message+ is already registered, the previously
|
33
33
|
# registered object is returned.
|
34
34
|
#
|
@@ -113,7 +113,7 @@ module YARD
|
|
113
113
|
#
|
114
114
|
# Locations of the +Message+ are used to generate the reference
|
115
115
|
# line that is started with "#: ". +relative_base_path+ passed
|
116
|
-
# when the
|
116
|
+
# when the generator is created is prepended to each path in location.
|
117
117
|
#
|
118
118
|
# Comments of the +Message+ are used to generate the
|
119
119
|
# translator-comment line that is started with "# ".
|
data/lib/yard/options.rb
CHANGED
@@ -94,7 +94,7 @@ module YARD
|
|
94
94
|
#
|
95
95
|
# @example Setting an option with Hash syntax
|
96
96
|
# options[:format] = :html # equivalent to: options.format = :html
|
97
|
-
# @param [Symbol, String] key the
|
97
|
+
# @param [Symbol, String] key the option to set
|
98
98
|
# @param [Object] value the value to set for the option
|
99
99
|
# @return [Object] the value being set
|
100
100
|
def []=(key, value) send("#{key}=", value) end
|
@@ -426,6 +426,13 @@ module YARD
|
|
426
426
|
def block_param
|
427
427
|
self[-1] ? self[-1][0] : nil
|
428
428
|
end
|
429
|
+
|
430
|
+
def args_forward
|
431
|
+
# shape is (required, optional, rest, more, keyword, keyword_rest, block)
|
432
|
+
# Ruby 3.1 moves :args_forward from rest to keyword_rest
|
433
|
+
args_index = YARD.ruby31? ? -2 : 2
|
434
|
+
self[args_index].type == :args_forward if self[args_index]
|
435
|
+
end
|
429
436
|
end
|
430
437
|
|
431
438
|
class MethodCallNode < AstNode
|
@@ -133,6 +133,12 @@ module YARD
|
|
133
133
|
AST_TOKENS = [:CHAR, :backref, :const, :cvar, :gvar, :heredoc_end, :ident,
|
134
134
|
:int, :float, :ivar, :label, :period, :regexp_end, :tstring_content, :backtick]
|
135
135
|
|
136
|
+
COMMENT_SKIP_NODE_TYPES = [
|
137
|
+
:comment,
|
138
|
+
:void_stmt,
|
139
|
+
:list
|
140
|
+
].freeze
|
141
|
+
|
136
142
|
MAPPINGS.each do |k, v|
|
137
143
|
if Array === v
|
138
144
|
v.each {|vv| (REV_MAPPINGS[vv] ||= []) << k }
|
@@ -144,7 +150,7 @@ module YARD
|
|
144
150
|
PARSER_EVENT_TABLE.each do |event, arity|
|
145
151
|
node_class = AstNode.node_class_for(event)
|
146
152
|
|
147
|
-
if /_new\z/ =~ event.to_s
|
153
|
+
if arity == 0 && /_new\z/ =~ event.to_s
|
148
154
|
module_eval(<<-eof, __FILE__, __LINE__ + 1)
|
149
155
|
def on_#{event}(*args)
|
150
156
|
#{node_class}.new(:list, args, :listchar => charno...charno, :listline => lineno..lineno)
|
@@ -613,7 +619,7 @@ module YARD
|
|
613
619
|
|
614
620
|
def insert_comments
|
615
621
|
root.traverse do |node|
|
616
|
-
next if
|
622
|
+
next if COMMENT_SKIP_NODE_TYPES.include?(node.type) || node.parent.type != :list
|
617
623
|
|
618
624
|
# never attach comments to if/unless mod nodes
|
619
625
|
if node.type == :if_mod || node.type == :unless_mod
|
@@ -476,9 +476,8 @@ module YARD
|
|
476
476
|
content.force_encoding('binary')
|
477
477
|
ENCODING_BYTE_ORDER_MARKS.each do |encoding, bom|
|
478
478
|
bom.force_encoding('binary')
|
479
|
-
if content
|
480
|
-
content.force_encoding(encoding)
|
481
|
-
return content
|
479
|
+
if content.start_with?(bom)
|
480
|
+
return content.sub(bom, '').force_encoding(encoding)
|
482
481
|
end
|
483
482
|
end
|
484
483
|
content.force_encoding('utf-8') # UTF-8 is default encoding
|
@@ -132,7 +132,8 @@ module YARD
|
|
132
132
|
|
133
133
|
path.scan(split_on_separators_match).each do |part, sep|
|
134
134
|
cur_obj = nil
|
135
|
-
pos +=
|
135
|
+
pos += part.length
|
136
|
+
pos += sep.length
|
136
137
|
parsed_end = pos == path.length
|
137
138
|
|
138
139
|
if !last_obj || (!parsed_end && !last_obj.is_a?(CodeObjects::NamespaceObject))
|
@@ -94,16 +94,16 @@ module YARD
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def call_with_fork(request, &block)
|
97
|
-
reader, writer
|
97
|
+
IO.pipe(:binmode => true) do |reader, writer|
|
98
|
+
fork do
|
99
|
+
log.debug "[pid=#{Process.pid}] fork serving: #{request.path}"
|
100
|
+
reader.close
|
101
|
+
writer.print(Marshal.dump(call_without_fork(request, &block)))
|
102
|
+
end
|
98
103
|
|
99
|
-
|
100
|
-
|
101
|
-
reader.close
|
102
|
-
writer.print(Marshal.dump(call_without_fork(request, &block)))
|
104
|
+
writer.close
|
105
|
+
Marshal.load(reader.read)
|
103
106
|
end
|
104
|
-
|
105
|
-
writer.close
|
106
|
-
Marshal.load(reader.read)
|
107
107
|
end
|
108
108
|
|
109
109
|
def can_fork?
|
@@ -1,5 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require 'webrick/httputils'
|
3
2
|
|
4
3
|
module YARD
|
5
4
|
module Server
|
@@ -7,7 +6,7 @@ module YARD
|
|
7
6
|
# Include this module to get access to {#static_template_file?}
|
8
7
|
# and {favicon?} helpers.
|
9
8
|
module StaticFileHelpers
|
10
|
-
include
|
9
|
+
include Server::HTTPUtils
|
11
10
|
|
12
11
|
# Serves an empty favicon.
|
13
12
|
# @raise [FinishRequest] finalizes an empty body if the path matches
|