Skip to content

Commit 03eb777

Browse files
st0012k0kubun
authored andcommitted
Sync RDoc 6.14.0
1 parent ca1ea95 commit 03eb777

File tree

185 files changed

+2007
-1654
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+2007
-1654
lines changed

doc/rdoc/markup_reference.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,15 @@
859859
# - On-page: <tt>DummyClass</tt> links to DummyClass.
860860
# - Off-page: <tt>RDoc::Alias</tt> links to RDoc::Alias.
861861
#
862+
# Note: For poeple want to mark up code (such as class, module,
863+
# constant, and method) as "<tt>+code+</tt>" (for interoperability
864+
# with other MarkDown parsers mainly), such word that refers a known
865+
# code object and is marked up entirely and separately as "monofont"
866+
# is also converted to a link.
867+
#
868+
# - <tt>+DummyClass+</tt> links to DummyClass
869+
# - <tt>+DummyClass-object+</tt> is not a link.
870+
#
862871
# [Module]
863872
#
864873
# - On-page: <tt>DummyModule</tt> links to DummyModule.
@@ -987,8 +996,7 @@
987996
# and entire <tt>rdoc-ref:</tt> square-bracketed clause is removed
988997
# from the resulting text.
989998
#
990-
# - <tt>Nosuch[rdoc-ref:RDoc::Nosuch]</tt> generates
991-
# Nosuch[rdoc-ref:RDoc::Nosuch].
999+
# - <tt>Nosuch[rdoc-ref:RDoc::Nosuch]</tt> generates Nosuch.
9921000
#
9931001
#
9941002
# [<tt>rdoc-label</tt> Scheme]

lib/rdoc/code_object.rb

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
# * RDoc::MetaMethod
2222
# * RDoc::Alias
2323
# * RDoc::Constant
24+
# * RDoc::Require
2425
# * RDoc::Mixin
25-
# * RDoc::Require
2626
# * RDoc::Include
27+
# * RDoc::Extend
2728

2829
class RDoc::CodeObject
2930

@@ -89,13 +90,6 @@ class RDoc::CodeObject
8990

9091
attr_reader :store
9192

92-
##
93-
# We are the model of the code, but we know that at some point we will be
94-
# worked on by viewers. By implementing the Viewable protocol, viewers can
95-
# associated themselves with these objects.
96-
97-
attr_accessor :viewer
98-
9993
##
10094
# When mixed-in to a class, this points to the Context in which it was originally defined.
10195

@@ -141,7 +135,6 @@ def initialize_visibility # :nodoc:
141135
def comment=(comment)
142136
@comment = case comment
143137
when NilClass then ''
144-
when RDoc::Markup::Document then comment
145138
when RDoc::Comment then comment.normalize
146139
else
147140
if comment and not comment.empty? then
@@ -217,20 +210,6 @@ def done_documenting=(value)
217210
@document_children = @document_self
218211
end
219212

220-
##
221-
# Yields each parent of this CodeObject. See also
222-
# RDoc::ClassModule#each_ancestor
223-
224-
def each_parent
225-
code_object = self
226-
227-
while code_object = code_object.parent do
228-
yield code_object
229-
end
230-
231-
self
232-
end
233-
234213
##
235214
# File name where this CodeObject was found.
236215
#
@@ -257,7 +236,7 @@ def force_documentation=(value)
257236
#
258237
# Set to +nil+ to clear RDoc's cached value
259238

260-
def full_name= full_name
239+
def full_name=(full_name)
261240
@full_name = full_name
262241
end
263242

@@ -301,11 +280,7 @@ def ignored?
301280
# This is used by Text#snippet
302281

303282
def options
304-
if @store and @store.rdoc then
305-
@store.rdoc.options
306-
else
307-
RDoc::Options.new
308-
end
283+
@store&.options || RDoc::Options.new
309284
end
310285

311286
##
@@ -331,13 +306,6 @@ def parent
331306
end
332307
end
333308

334-
##
335-
# File name of our parent
336-
337-
def parent_file_name
338-
@parent ? @parent.base_name : '(unknown)'
339-
end
340-
341309
##
342310
# Name of our parent
343311

@@ -348,7 +316,7 @@ def parent_name
348316
##
349317
# Records the RDoc::TopLevel (file) where this code object was defined
350318

351-
def record_location top_level
319+
def record_location(top_level)
352320
@ignored = false
353321
@suppressed = false
354322
@file = top_level
@@ -390,7 +358,7 @@ def stop_doc
390358
##
391359
# Sets the +store+ that contains this CodeObject
392360

393-
def store= store
361+
def store=(store)
394362
@store = store
395363

396364
return unless @track_visibility

lib/rdoc/code_object/alias.rb

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class RDoc::Alias < RDoc::CodeObject
2323
##
2424
# Is this an alias declared in a singleton context?
2525

26-
attr_accessor :singleton
26+
attr_reader :singleton
2727

2828
##
2929
# Source file token stream
@@ -34,7 +34,7 @@ class RDoc::Alias < RDoc::CodeObject
3434
# Creates a new Alias with a token stream of +text+ that aliases +old_name+
3535
# to +new_name+, has +comment+ and is a +singleton+ context.
3636

37-
def initialize(text, old_name, new_name, comment, singleton = false)
37+
def initialize(text, old_name, new_name, comment, singleton: false)
3838
super()
3939

4040
@text = text
@@ -59,13 +59,6 @@ def aref
5959
"#alias-#{type}-#{html_name}"
6060
end
6161

62-
##
63-
# Full old name including namespace
64-
65-
def full_old_name
66-
@full_name || "#{parent.name}#{pretty_old_name}"
67-
end
68-
6962
##
7063
# HTML id-friendly version of +#new_name+.
7164

lib/rdoc/code_object/any_method.rb

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ class RDoc::AnyMethod < RDoc::MethodAttr
2929
# The section title of the method (if defined in a C file via +:category:+)
3030
attr_accessor :section_title
3131

32-
# Parameters for this method
33-
34-
attr_accessor :params
35-
3632
##
3733
# If true this method uses +super+ to call a superclass version
3834

@@ -43,8 +39,8 @@ class RDoc::AnyMethod < RDoc::MethodAttr
4339
##
4440
# Creates a new AnyMethod with a token stream +text+ and +name+
4541

46-
def initialize text, name
47-
super
42+
def initialize(text, name, singleton: false)
43+
super(text, name, singleton: singleton)
4844

4945
@c_function = nil
5046
@dont_rename_initialize = false
@@ -56,11 +52,10 @@ def initialize text, name
5652
##
5753
# Adds +an_alias+ as an alias for this method in +context+.
5854

59-
def add_alias an_alias, context = nil
60-
method = self.class.new an_alias.text, an_alias.new_name
55+
def add_alias(an_alias, context = nil)
56+
method = self.class.new an_alias.text, an_alias.new_name, singleton: singleton
6157

6258
method.record_location an_alias.file
63-
method.singleton = self.singleton
6459
method.params = self.params
6560
method.visibility = self.visibility
6661
method.comment = an_alias.comment
@@ -109,8 +104,8 @@ def call_seq
109104
#
110105
# See also #param_seq
111106

112-
def call_seq= call_seq
113-
return if call_seq.empty?
107+
def call_seq=(call_seq)
108+
return if call_seq.nil? || call_seq.empty?
114109

115110
@call_seq = call_seq
116111
end
@@ -181,7 +176,7 @@ def marshal_dump
181176
# * #full_name
182177
# * #parent_name
183178

184-
def marshal_load array
179+
def marshal_load(array)
185180
initialize_visibility
186181

187182
@dont_rename_initialize = nil
@@ -198,7 +193,7 @@ def marshal_load array
198193
@full_name = array[2]
199194
@singleton = array[3]
200195
@visibility = array[4]
201-
@comment = array[5]
196+
@comment = RDoc::Comment.from_document array[5]
202197
@call_seq = array[6]
203198
@block_params = array[7]
204199
# 8 handled below
@@ -210,8 +205,8 @@ def marshal_load array
210205
@section_title = array[14]
211206
@is_alias_for = array[15]
212207

213-
array[8].each do |new_name, comment|
214-
add_alias RDoc::Alias.new(nil, @name, new_name, comment, @singleton)
208+
array[8].each do |new_name, document|
209+
add_alias RDoc::Alias.new(nil, @name, new_name, RDoc::Comment.from_document(document), singleton: @singleton)
215210
end
216211

217212
@parent_name ||= if @full_name =~ /#/ then
@@ -314,7 +309,7 @@ def skip_description?
314309
##
315310
# Sets the store for this method and its referenced code objects.
316311

317-
def store= store
312+
def store=(store)
318313
super
319314

320315
@file = @store.add_file @file.full_name if @file

lib/rdoc/code_object/attr.rb

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,17 @@ class RDoc::Attr < RDoc::MethodAttr
2222
# Creates a new Attr with body +text+, +name+, read/write status +rw+ and
2323
# +comment+. +singleton+ marks this as a class attribute.
2424

25-
def initialize(text, name, rw, comment, singleton = false)
26-
super text, name
25+
def initialize(text, name, rw, comment, singleton: false)
26+
super(text, name, singleton: singleton)
2727

2828
@rw = rw
29-
@singleton = singleton
3029
self.comment = comment
3130
end
3231

3332
##
3433
# Attributes are equal when their names, singleton and rw are identical
3534

36-
def == other
35+
def ==(other)
3736
self.class == other.class and
3837
self.name == other.name and
3938
self.rw == other.rw and
@@ -44,9 +43,7 @@ def == other
4443
# Add +an_alias+ as an attribute in +context+.
4544

4645
def add_alias(an_alias, context)
47-
new_attr = self.class.new(self.text, an_alias.new_name, self.rw,
48-
self.comment, self.singleton)
49-
46+
new_attr = self.class.new(text, an_alias.new_name, rw, comment, singleton: singleton)
5047
new_attr.record_location an_alias.file
5148
new_attr.visibility = self.visibility
5249
new_attr.is_alias_for = self
@@ -121,7 +118,7 @@ def marshal_dump
121118
# * #full_name
122119
# * #parent_name
123120

124-
def marshal_load array
121+
def marshal_load(array)
125122
initialize_visibility
126123

127124
@aliases = []
@@ -136,7 +133,7 @@ def marshal_load array
136133
@full_name = array[2]
137134
@rw = array[3]
138135
@visibility = array[4]
139-
@comment = array[5]
136+
@comment = RDoc::Comment.from_document array[5]
140137
@singleton = array[6] || false # MARSHAL_VERSION == 0
141138
# 7 handled below
142139
@parent_name = array[8]
@@ -148,7 +145,7 @@ def marshal_load array
148145
@parent_name ||= @full_name.split('#', 2).first
149146
end
150147

151-
def pretty_print q # :nodoc:
148+
def pretty_print(q) # :nodoc:
152149
q.group 2, "[#{self.class.name} #{full_name} #{rw} #{visibility}", "]" do
153150
unless comment.empty? then
154151
q.breakable

0 commit comments

Comments
 (0)