diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2011-08-29 14:55:33 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2011-08-29 14:56:00 +0100 |
commit | e57fa3d276d700ea21c97f8c2d3731f0f9d4c7ab (patch) | |
tree | 1c9e555bde2d3b1a2007841f02ae62b3c3520b37 /vendor/gems/rdoc-2.4.3/lib/rdoc/attr.rb | |
parent | 3084034493a428b2394a59b68921ed4b73a8cf7e (diff) | |
parent | b4aefe5a69bbd492959931f1c577a028ec361993 (diff) |
Attempt to merge current develop to theme
Diffstat (limited to 'vendor/gems/rdoc-2.4.3/lib/rdoc/attr.rb')
-rw-r--r-- | vendor/gems/rdoc-2.4.3/lib/rdoc/attr.rb | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/vendor/gems/rdoc-2.4.3/lib/rdoc/attr.rb b/vendor/gems/rdoc-2.4.3/lib/rdoc/attr.rb new file mode 100644 index 000000000..235a5ab23 --- /dev/null +++ b/vendor/gems/rdoc-2.4.3/lib/rdoc/attr.rb @@ -0,0 +1,79 @@ +require 'rdoc/code_object' + +## +# An attribute created by \#attr, \#attr_reader, \#attr_writer or +# \#attr_accessor + +class RDoc::Attr < RDoc::CodeObject + + ## + # Name of the attribute + + attr_accessor :name + + ## + # Is the attribute readable, writable or both? + + attr_accessor :rw + + ## + # Source file token stream + + attr_accessor :text + + ## + # public, protected, private + + attr_accessor :visibility + + def initialize(text, name, rw, comment) + super() + @text = text + @name = name + @rw = rw + @visibility = :public + self.comment = comment + end + + ## + # Attributes are ordered by name + + def <=>(other) + self.name <=> other.name + end + + ## + # An HTML id-friendly representation of #name + + def html_name + @name.gsub(/[^a-z]+/, '-') + end + + def inspect # :nodoc: + attr = case rw + when 'RW' then :attr_accessor + when 'R' then :attr_reader + when 'W' then :attr_writer + else + " (#{rw})" + end + + "#<%s:0x%x %s.%s :%s>" % [ + self.class, object_id, + parent_name, attr, @name, + ] + end + + ## + # URL path for this attribute + + def path + "#{@parent.path}##{@name}" + end + + def to_s # :nodoc: + "attr: #{self.name} #{self.rw}\n#{self.comment}" + end + +end + |