Class: RDoc::Require
- Inherits:
-
CodeObject
- Object
- CodeObject
- RDoc::Require
- Defined in:
- lib/rdoc/require.rb
Overview
A file loaded by #require
Constant Summary
Constants included from Text
Text::MARKUP_FORMAT, Text::TO_HTML_CHARACTERS
Instance Attribute Summary collapse
-
#name ⇒ Object
Name of the required file.
Attributes inherited from CodeObject
#comment, #document_children, #document_self, #done_documenting, #file, #force_documentation, #line, #metadata, #parent, #received_nodoc, #section, #store, #viewer
Attributes included from Text
Instance Method Summary collapse
-
#initialize(name, comment) ⇒ Require
constructor
Creates a new Require that loads
name
withcomment
. -
#inspect ⇒ Object
:nodoc:.
-
#to_s ⇒ Object
:nodoc:.
-
#top_level ⇒ Object
The RDoc::TopLevel corresponding to this require, or
nil
if not found.
Methods inherited from CodeObject
#display?, #documented?, #each_parent, #file_name, #full_name=, #ignore, #ignored?, #initialize_visibility, #options, #parent_file_name, #parent_name, #record_location, #start_doc, #stop_doc, #suppress, #suppressed?
Methods included from Generator::Markup
#aref_to, #as_href, #cvs_url, #description, #formatter
Methods included from Text
encode_fallback, #expand_tabs, #flush_left, #markup, #normalize_comment, #parse, #snippet, #strip_hashes, #strip_newlines, #strip_stars, #to_html, #wrap
Constructor Details
#initialize(name, comment) ⇒ Require
Creates a new Require that loads name
with comment
15 16 17 18 19 20 |
# File 'lib/rdoc/require.rb', line 15 def initialize(name, comment) super() @name = name.gsub(/'|"/, "") #' @top_level = nil self.comment = comment end |
Instance Attribute Details
#name ⇒ Object
Name of the required file
10 11 12 |
# File 'lib/rdoc/require.rb', line 10 def name @name end |
Instance Method Details
#inspect ⇒ Object
:nodoc:
22 23 24 25 26 27 28 29 |
# File 'lib/rdoc/require.rb', line 22 def inspect # :nodoc: "#<%s:0x%x require '%s' in %s>" % [ self.class, object_id, @name, parent_file_name, ] end |
#to_s ⇒ Object
:nodoc:
31 32 33 |
# File 'lib/rdoc/require.rb', line 31 def to_s # :nodoc: "require #{name} in: #{parent}" end |
#top_level ⇒ Object
The RDoc::TopLevel corresponding to this require, or nil
if not found.
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rdoc/require.rb', line 38 def top_level @top_level ||= begin tl = RDoc::TopLevel.all_files_hash[name + '.rb'] if tl.nil? and RDoc::TopLevel.all_files.first.full_name =~ %r(^lib/) then # second chance tl = RDoc::TopLevel.all_files_hash['lib/' + name + '.rb'] end tl end end |