yard 0.9.42 → 0.9.43
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/CHANGELOG.md +6 -0
- data/lib/yard/handlers/rbs/attribute_handler.rb +44 -8
- data/lib/yard/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 92d411c4d39cc74df916cbac8719ebd7ac6ed1fb17b37022148f584440bda554
|
|
4
|
+
data.tar.gz: 9582c48d6c1949c055e22035f325abc957ec31900613f5b04307f7f27fc011a4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d566d6989e868b3bc4959037309c9c07a89608f07a39ad2719ead8765fca6ab3ae6240bfe7d56394ad47c8d75c5999d02313f6f7eaedb056a2ea584750d15cc1
|
|
7
|
+
data.tar.gz: 641e462842732b47a67ff95eda6cfdb0373de7b2f487ceb7aa827815c0f8201fa55639979f7df17ec4d12864de60c4cc631fc7921cc787b20a04f5493cd86033
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# main
|
|
2
2
|
|
|
3
|
+
# [0.9.43] - April 17th, 2026
|
|
4
|
+
|
|
5
|
+
[0.9.43]: https://github.com/lsegal/yard/compare/v0.9.42...v0.9.43
|
|
6
|
+
|
|
7
|
+
- Fix attribute registration in .rbs files (#1583)
|
|
8
|
+
|
|
3
9
|
# [0.9.42] - April 16th, 2026
|
|
4
10
|
|
|
5
11
|
[0.9.42]: https://github.com/lsegal/yard/compare/v0.9.41...v0.9.42
|
|
@@ -15,7 +15,9 @@ class YARD::Handlers::RBS::AttributeHandler < YARD::Handlers::RBS::Base
|
|
|
15
15
|
case statement.type
|
|
16
16
|
when :attr_reader
|
|
17
17
|
register_reader(attr_name, yard_types, mscope)
|
|
18
|
+
register_existing_attribute_method(attr_name, "#{attr_name}=", :write, mscope)
|
|
18
19
|
when :attr_writer
|
|
20
|
+
register_existing_attribute_method(attr_name, attr_name, :read, mscope)
|
|
19
21
|
register_writer(attr_name, yard_types, mscope)
|
|
20
22
|
when :attr_accessor
|
|
21
23
|
register_reader(attr_name, yard_types, mscope)
|
|
@@ -26,18 +28,52 @@ class YARD::Handlers::RBS::AttributeHandler < YARD::Handlers::RBS::Base
|
|
|
26
28
|
private
|
|
27
29
|
|
|
28
30
|
def register_reader(name, types, scope)
|
|
29
|
-
obj =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
obj = MethodObject.new(namespace, name, scope)
|
|
32
|
+
obj.source ||= "def #{name}\n @#{name}\nend"
|
|
33
|
+
obj.signature ||= "def #{name}"
|
|
34
|
+
obj = register(obj)
|
|
35
|
+
obj.docstring = "Returns the value of attribute #{name}." if obj.docstring.blank?(false)
|
|
36
|
+
apply_tag_types(obj, :return, types)
|
|
37
|
+
namespace.attributes[obj.scope][name] ||= SymbolHash[:read => nil, :write => nil]
|
|
38
|
+
namespace.attributes[obj.scope][name][:read] = obj
|
|
33
39
|
obj
|
|
34
40
|
end
|
|
35
41
|
|
|
36
42
|
def register_writer(name, types, scope)
|
|
37
|
-
obj =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
obj = MethodObject.new(namespace, "#{name}=", scope)
|
|
44
|
+
obj.parameters = [['value', nil]]
|
|
45
|
+
obj.source ||= "def #{name}=(value)\n @#{name} = value\nend"
|
|
46
|
+
obj.signature ||= "def #{name}=(value)"
|
|
47
|
+
obj = register(obj)
|
|
48
|
+
obj.docstring = "Sets the attribute #{name}\n@param value the value to set the attribute #{name} to." if obj.docstring.blank?(false)
|
|
49
|
+
apply_tag_types(obj, :param, types, "value")
|
|
50
|
+
namespace.attributes[obj.scope][name] ||= SymbolHash[:read => nil, :write => nil]
|
|
51
|
+
namespace.attributes[obj.scope][name][:write] = obj
|
|
41
52
|
obj
|
|
42
53
|
end
|
|
54
|
+
|
|
55
|
+
def register_existing_attribute_method(attr_name, meth_name, type, scope)
|
|
56
|
+
namespace.attributes[scope][attr_name] ||= SymbolHash[:read => nil, :write => nil]
|
|
57
|
+
return if namespace.attributes[scope][attr_name][type]
|
|
58
|
+
|
|
59
|
+
obj = namespace.children.find do |other|
|
|
60
|
+
other.name == meth_name.to_sym && other.scope == scope
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
namespace.attributes[scope][attr_name][type] = obj if obj
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def apply_tag_types(obj, tag_name, types, tag_param_name = nil)
|
|
67
|
+
return unless types
|
|
68
|
+
|
|
69
|
+
tag = obj.tags(tag_name).find do |existing_tag|
|
|
70
|
+
existing_tag.name == tag_param_name
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
if tag
|
|
74
|
+
tag.types ||= types
|
|
75
|
+
else
|
|
76
|
+
obj.add_tag YARD::Tags::Tag.new(tag_name, '', types, tag_param_name)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
43
79
|
end
|
data/lib/yard/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yard
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.43
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Loren Segal
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-04-
|
|
11
|
+
date: 2026-04-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |2
|
|
14
14
|
YARD is a documentation generation tool for the Ruby programming language.
|