Support visibility modifiers for attributes

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
dave 2004-02-19 14:26:05 +00:00
Родитель 0425463a3d
Коммит ba3a872a68
3 изменённых файлов: 32 добавлений и 7 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Thu Feb 19 23:24:16 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/generators/html_generator.rb (Generators::HtmlClass::build_attribute_list):
Support visibility modifiers for attributes
Thu Feb 19 22:39:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au> Thu Feb 19 22:39:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/ostruct.rb: documented * lib/ostruct.rb: documented

Просмотреть файл

@ -146,9 +146,22 @@ module RDoc
# visibility of the corresponding AnyMethod object # visibility of the corresponding AnyMethod object
def set_visibility_for(methods, vis, singleton=false) def set_visibility_for(methods, vis, singleton=false)
@method_list.each_with_index do |m,i| count = 0
@method_list.each do |m|
if methods.include?(m.name) && m.singleton == singleton if methods.include?(m.name) && m.singleton == singleton
m.visibility = vis m.visibility = vis
count += 1
end
end
return if count == methods.size || singleton
# perhaps we need to look at attributes
@attributes.each do |a|
if methods.include?(a.name)
a.visibility = vis
count += 1
end end
end end
end end
@ -627,13 +640,14 @@ module RDoc
# Represent attributes # Represent attributes
class Attr < CodeObject class Attr < CodeObject
attr_accessor :text, :name, :rw attr_accessor :text, :name, :rw, :visibility
def initialize(text, name, rw, comment) def initialize(text, name, rw, comment)
super() super()
@text = text @text = text
@name = name @name = name
@rw = rw @rw = rw
@visibility = :public
self.comment = comment self.comment = comment
end end

Просмотреть файл

@ -620,11 +620,17 @@ module Generators
atts = @context.attributes.sort atts = @context.attributes.sort
res = [] res = []
atts.each do |att| atts.each do |att|
res << { if att.visibility == :public || @options.show_all
"name" => CGI.escapeHTML(att.name), entry = {
"rw" => att.rw, "name" => CGI.escapeHTML(att.name),
"a_desc" => markup(att.comment, true) "rw" => att.rw,
} "a_desc" => markup(att.comment, true)
}
unless att.visibility == :public
entry["rw"] << "-"
end
res << entry
end
end end
res res
end end