2017-11-27 05:45:24 -05:00
|
|
|
# frozen_string_literal: true
|
2010-04-01 03:45:16 -04:00
|
|
|
##
|
|
|
|
# A normal module, like NormalClass
|
|
|
|
|
|
|
|
class RDoc::NormalModule < RDoc::ClassModule
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
def aref_prefix # :nodoc:
|
|
|
|
'module'
|
|
|
|
end
|
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
def inspect # :nodoc:
|
2012-11-26 23:28:14 -05:00
|
|
|
"#<%s:0x%x module %s includes: %p extends: %p attributes: %p methods: %p aliases: %p>" % [
|
2010-04-01 03:45:16 -04:00
|
|
|
self.class, object_id,
|
2012-11-26 23:28:14 -05:00
|
|
|
full_name, @includes, @extends, @attributes, @method_list, @aliases
|
2010-04-01 03:45:16 -04:00
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2011-02-01 19:32:30 -05:00
|
|
|
##
|
|
|
|
# The definition of this module, <tt>module MyModuleName</tt>
|
|
|
|
|
|
|
|
def definition
|
|
|
|
"module #{full_name}"
|
|
|
|
end
|
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
##
|
|
|
|
# This is a module, returns true
|
|
|
|
|
|
|
|
def module?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def pretty_print q # :nodoc:
|
|
|
|
q.group 2, "[module #{full_name}: ", "]" do
|
|
|
|
q.breakable
|
|
|
|
q.text "includes:"
|
|
|
|
q.breakable
|
|
|
|
q.seplist @includes do |inc| q.pp inc end
|
|
|
|
q.breakable
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
q.breakable
|
|
|
|
q.text "constants:"
|
|
|
|
q.breakable
|
|
|
|
q.seplist @constants do |const| q.pp const end
|
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
q.text "attributes:"
|
|
|
|
q.breakable
|
2012-11-26 23:28:14 -05:00
|
|
|
q.seplist @attributes do |attr| q.pp attr end
|
2010-04-01 03:45:16 -04:00
|
|
|
q.breakable
|
|
|
|
|
|
|
|
q.text "methods:"
|
|
|
|
q.breakable
|
2012-11-26 23:28:14 -05:00
|
|
|
q.seplist @method_list do |meth| q.pp meth end
|
2010-04-01 03:45:16 -04:00
|
|
|
q.breakable
|
|
|
|
|
|
|
|
q.text "aliases:"
|
|
|
|
q.breakable
|
2012-11-26 23:28:14 -05:00
|
|
|
q.seplist @aliases do |aliaz| q.pp aliaz end
|
2010-04-01 03:45:16 -04:00
|
|
|
q.breakable
|
|
|
|
|
|
|
|
q.text "comment:"
|
|
|
|
q.breakable
|
|
|
|
q.pp comment
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
##
|
|
|
|
# Modules don't have one, raises NoMethodError
|
|
|
|
|
|
|
|
def superclass
|
|
|
|
raise NoMethodError, "#{full_name} is a module"
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|