P
Patrick Gundlach
Hello out there,
I have a lot of get/set methods that take some complex data structure.
They behave like attributes. Now I would like to use rdoc
so that these methods appear in the attributes section (just like the
ones created with attr_accessor et al.) but are not defined with
attr_accessor, because Ruby gives me lots of warnings about redefining
the method.
So now I have:
class Foo
# Bar is very important
attr_accessor :bar
# Baz is crazy
attr_accessor :baz
def bar= (obj) #:nodoc:
...
end
def bar #:nodoc:
# calculate
return @complex_data_structure
end
def baz= (obj) #:nodoc:
...
end
def baz #:nodoc:
...
end
end
Running rdoc gives me something like
Attributes
-----------
bar [RW] Bar is very important
baz [RW] Baz is crazy
which is exactly what I want, but I would like to avoid creating dummy
methods with attr_accessor for some of the attributes. How can I tell
rdoc to write my methods as attributes? Or perhaps to tell ruby to
ignore those attr_accessor calls? =begin =end does not seem to work
(rdoc refuses to go through that section). Same with "if false ....
end".
Patrick
I have a lot of get/set methods that take some complex data structure.
They behave like attributes. Now I would like to use rdoc
so that these methods appear in the attributes section (just like the
ones created with attr_accessor et al.) but are not defined with
attr_accessor, because Ruby gives me lots of warnings about redefining
the method.
So now I have:
class Foo
# Bar is very important
attr_accessor :bar
# Baz is crazy
attr_accessor :baz
def bar= (obj) #:nodoc:
...
end
def bar #:nodoc:
# calculate
return @complex_data_structure
end
def baz= (obj) #:nodoc:
...
end
def baz #:nodoc:
...
end
end
Running rdoc gives me something like
Attributes
-----------
bar [RW] Bar is very important
baz [RW] Baz is crazy
which is exactly what I want, but I would like to avoid creating dummy
methods with attr_accessor for some of the attributes. How can I tell
rdoc to write my methods as attributes? Or perhaps to tell ruby to
ignore those attr_accessor calls? =begin =end does not seem to work
(rdoc refuses to go through that section). Same with "if false ....
end".
Patrick