Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v2_2_9) is shown here.
find_attr_comment(var_name, attr_name, read = nil, write = nil)
public
Finds a comment for rb_define_attr, rb_attr or Document-attr.
var_name is the C class variable the attribute is defined on.
attr_name is the attribute’s name.
read and write are the read/write flags (‘1’ or
‘0’). Either both or neither must be provided.
# File lib/rdoc/parser/c.rb, line 578
def find_attr_comment var_name, attr_name, read = nil, write = nil
attr_name = Regexp.escape attr_name
rw = if read and write then
/\s*#{read}\s*,\s*#{write}\s*/m
else
/.*?/
end
comment = if @content =~ %((?>/\*.*?\*/\s+))
rb_define_attr\((?:\s*#{var_name},)?\s*
"#{attr_name}"\s*,
#{rw}\)\s*;%m then
$1
elsif @content =~ %((?>/\*.*?\*/\s+))
rb_attr\(\s*#{var_name}\s*,
\s*#{attr_name}\s*,
#{rw},.*?\)\s*;%m then
$1
elsif @content =~ %(/\*.*?(?:\s*\*\s*)?)
Document-attr:\s#{attr_name}\s*?\n
((?>(.|\n)*?\*/))% then
"#{$1}\n#{$2}"
else
''
end
RDoc::Comment.new comment, @top_level
end