class RDoc::TopLevel
def == other
def == other self.class === other and @relative_name == other.relative_name end
def add_alias(an_alias)
def add_alias(an_alias) object_class.record_location self return an_alias unless @document_self object_class.add_alias an_alias end
def add_constant constant
def add_constant constant object_class.record_location self return constant unless @document_self object_class.add_constant constant end
def add_include(include)
def add_include(include) object_class.record_location self return include unless @document_self object_class.add_include include end
def add_method(method)
def add_method(method) object_class.record_location self return method unless @document_self object_class.add_method method end
def add_to_classes_or_modules mod
def add_to_classes_or_modules mod @classes_or_modules << mod end
def base_name
def base_name File.basename @relative_name end
def cvs_url
def cvs_url url = @store.rdoc.options.webcvs if /%s/ =~ url then url % @relative_name else url + @relative_name end end
def display?
def display? text? and super end
def find_class_or_module name
def find_class_or_module name @store.find_class_or_module name end
def find_local_symbol(symbol)
def find_local_symbol(symbol) find_class_or_module(symbol) || super end
def find_module_named(name)
def find_module_named(name) find_class_or_module(name) end
def full_name
def full_name @relative_name end
def hash
def hash @relative_name.hash end
def http_url(prefix)
def http_url(prefix) path = [prefix, @relative_name.tr('.', '_')] File.join(*path.compact) + '.html' end
def initialize absolute_name, relative_name = absolute_name
def initialize absolute_name, relative_name = absolute_name super() @name = nil @absolute_name = absolute_name @relative_name = relative_name @file_stat = File.stat(absolute_name) rescue nil # HACK for testing @diagram = nil @parser = nil @classes_or_modules = [] end
def inspect # :nodoc:
def inspect # :nodoc: "#<%s:0x%x %p modules: %p classes: %p>" % [ self.class, object_id, base_name, @modules.map { |n,m| m }, @classes.map { |n,c| c } ] end
def last_modified
def last_modified @file_stat ? file_stat.mtime : nil end
def marshal_dump
def marshal_dump [ MARSHAL_VERSION, @relative_name, @parser, parse(@comment), ] end
def marshal_load array # :nodoc:
def marshal_load array # :nodoc: initialize array[1] @parser = array[2] @comment = array[3] @file_stat = nil end
def object_class
def object_class @object_class ||= begin oc = @store.find_class_named('Object') || add_class(RDoc::NormalClass, 'Object') oc.record_location self oc end end
def page_name
def page_name basename = File.basename @relative_name basename =~ /\.(rb|rdoc|txt|md)$/i $` || basename end
def parser=(val)
def parser=(val) @parser = val @store.update_parser_of_file(absolute_name, val) if @store @parser end
def path
def path http_url @store.rdoc.generator.file_dir end
def pretty_print q # :nodoc:
def pretty_print q # :nodoc: q.group 2, "[#{self.class}: ", "]" do q.text "base name: #{base_name.inspect}" q.breakable items = @modules.map { |n,m| m } items.concat @modules.map { |n,c| c } q.seplist items do |mod| q.pp mod end end end
def search_record
def search_record return unless @parser < RDoc::Parser::Text [ page_name, '', page_name, '', path, '', snippet(@comment), ] end
def text?
def text? @parser and @parser.include? RDoc::Parser::Text end
def to_s # :nodoc:
def to_s # :nodoc: "file #{full_name}" end