summaryrefslogtreecommitdiff
path: root/lib/rdoc/attr.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/attr.rb')
-rw-r--r--lib/rdoc/attr.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/rdoc/attr.rb b/lib/rdoc/attr.rb
index f04fe168b1..5d9bc17831 100644
--- a/lib/rdoc/attr.rb
+++ b/lib/rdoc/attr.rb
@@ -6,7 +6,7 @@ require 'rdoc/method_attr'
class RDoc::Attr < RDoc::MethodAttr
- MARSHAL_VERSION = 1 # :nodoc:
+ MARSHAL_VERSION = 2 # :nodoc:
##
# Is the attribute readable ('R'), writable ('W') or both ('RW')?
@@ -92,6 +92,7 @@ class RDoc::Attr < RDoc::MethodAttr
@visibility,
parse(@comment),
singleton,
+ @file.absolute_name,
]
end
@@ -103,6 +104,7 @@ class RDoc::Attr < RDoc::MethodAttr
# * #parent_name
def marshal_load array
+ version = array[0]
@name = array[1]
@full_name = array[2]
@rw = array[3]
@@ -110,9 +112,22 @@ class RDoc::Attr < RDoc::MethodAttr
@comment = array[5]
@singleton = array[6] || false # MARSHAL_VERSION == 0
+ @file = RDoc::TopLevel.new array[7] if version > 1
+
@parent_name = @full_name
end
+ def pretty_print q # :nodoc:
+ q.group 2, "[#{self.class.name} #{full_name} #{rw} #{visibility}", "]" do
+ unless comment.empty? then
+ q.breakable
+ q.text "comment:"
+ q.breakable
+ q.pp @comment
+ end
+ end
+ end
+
def to_s # :nodoc:
"#{definition} #{name} in: #{parent}"
end