Class: RDoc::Require
- Inherits:
-
CodeObject
- Object
- CodeObject
- RDoc::Require
- Defined in:
- lib/rdoc/require.rb
Overview
A file loaded by #require
Constant Summary
Constant Summary
Constants included from Text
Instance Attribute Summary (collapse)
-
- (Object) name
Name of the required file.
Attributes inherited from CodeObject
#comment, #document_children, #document_self, #done_documenting, #file, #force_documentation, #line, #metadata, #offset, #parent, #received_nodoc, #section, #viewer
Instance Method Summary (collapse)
-
- (Require) initialize(name, comment)
constructor
Creates a new Require that loads name with comment.
-
- (Object) inspect
:nodoc:.
-
- (Object) to_s
:nodoc:.
-
- (Object) top_level
The RDoc::TopLevel corresponding to this require, or nil if not found.
Methods inherited from CodeObject
#documented?, #full_name=, #parent_file_name, #parent_name, #record_location, #start_doc, #stop_doc
Methods included from Text
encode_fallback, #expand_tabs, #flush_left, #markup, #normalize_comment, #parse, #strip_hashes, #strip_newlines, #strip_stars, #to_html, #wrap
Constructor Details
- (Require) initialize(name, comment)
Creates a new Require that loads name with comment
16 17 18 19 20 21 |
# File 'lib/rdoc/require.rb', line 16 def initialize(name, comment) super() @name = name.gsub(/'|"/, "") #' @top_level = nil self.comment = comment end |
Instance Attribute Details
- (Object) name
Name of the required file
11 12 13 |
# File 'lib/rdoc/require.rb', line 11 def name @name end |
Instance Method Details
- (Object) inspect
:nodoc:
23 24 25 26 27 28 29 30 |
# File 'lib/rdoc/require.rb', line 23 def inspect # :nodoc: "#<%s:0x%x require '%s' in %s>" % [ self.class, object_id, @name, parent_file_name, ] end |
- (Object) to_s
:nodoc:
32 33 34 |
# File 'lib/rdoc/require.rb', line 32 def to_s # :nodoc: "require #{name} in: #{parent}" end |
- (Object) top_level
The RDoc::TopLevel corresponding to this require, or nil if not found.
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rdoc/require.rb', line 39 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 |