summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-19 14:26:05 +0000
committerdave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-19 14:26:05 +0000
commit81f62f41f18dcbbb974b8081a691c49bae372bd3 (patch)
treea5ebc1116441bca8293baa38914a0d0393761acf
parentbab666da0b38b2ed9f980924786e3329b4b4a752 (diff)
Support visibility modifiers for attributes
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog10
-rw-r--r--lib/rdoc/code_objects.rb18
-rw-r--r--lib/rdoc/generators/html_generator.rb16
3 files changed, 37 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 94f52a293da..3f06fe33f5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+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 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:04 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* test/rinda/test_rinda.rb: DRb.start_service only once in testsuites.
diff --git a/lib/rdoc/code_objects.rb b/lib/rdoc/code_objects.rb
index a8c3752cb86..c48f5957b20 100644
--- a/lib/rdoc/code_objects.rb
+++ b/lib/rdoc/code_objects.rb
@@ -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
diff --git a/lib/rdoc/generators/html_generator.rb b/lib/rdoc/generators/html_generator.rb
index 56ac2b74999..b7d3961b45b 100644
--- a/lib/rdoc/generators/html_generator.rb
+++ b/lib/rdoc/generators/html_generator.rb
@@ -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