mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
46580b5147
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
61 lines
982 B
Ruby
61 lines
982 B
Ruby
require 'rdoc/code_object'
|
|
|
|
##
|
|
# A Module include in a class with \#include
|
|
|
|
class RDoc::Include < RDoc::CodeObject
|
|
|
|
##
|
|
# Name of included module
|
|
|
|
attr_accessor :name
|
|
|
|
##
|
|
# Creates a new Include for +name+ with +comment+
|
|
|
|
def initialize(name, comment)
|
|
super()
|
|
@name = name
|
|
self.comment = comment
|
|
end
|
|
|
|
##
|
|
# Includes are sorted by name
|
|
|
|
def <=> other
|
|
return unless self.class === other
|
|
|
|
name <=> other.name
|
|
end
|
|
|
|
def == other # :nodoc:
|
|
self.class == other.class and
|
|
self.name == other.name
|
|
end
|
|
|
|
##
|
|
# Full name based on #module
|
|
|
|
def full_name
|
|
m = self.module
|
|
RDoc::ClassModule === m ? m.full_name : @name
|
|
end
|
|
|
|
def inspect # :nodoc:
|
|
"#<%s:0x%x %s.include %s>" % [
|
|
self.class,
|
|
object_id,
|
|
parent_name, @name,
|
|
]
|
|
end
|
|
|
|
##
|
|
# Attempts to locate the included module object. Returns the name if not
|
|
# known.
|
|
|
|
def module
|
|
RDoc::TopLevel.find_module_named(@name) || @name
|
|
end
|
|
|
|
end
|
|
|