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>
* lib/ostruct.rb: documented

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

@ -146,9 +146,22 @@ module RDoc
# visibility of the corresponding AnyMethod object
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
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
@ -627,13 +640,14 @@ module RDoc
# Represent attributes
class Attr < CodeObject
attr_accessor :text, :name, :rw
attr_accessor :text, :name, :rw, :visibility
def initialize(text, name, rw, comment)
super()
@text = text
@name = name
@rw = rw
@visibility = :public
self.comment = comment
end

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

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