A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.ruby-lang.org/en/3.1/RDoc/CodeObject.html below:

class RDoc::CodeObject - RDoc Documentation

Attributes

document_children[R]

Do we document our children?

document_self[R]

Do we document ourselves?

done_documenting[R]

Are we done documenting (ie, did we come across a :enddoc:)?

file[R]

Which file this code object was defined in

force_documentation[R]

Force documentation of this CodeObject

received_nodoc[R]

Did we ever receive a :nodoc: directive?

viewer[RW]

We are the model of the code, but we know that at some point we will be worked on by viewers. By implementing the Viewable protocol, viewers can associated themselves with these objects.

Public Class Methods

new() click to toggle source

Creates a new CodeObject that will document itself and its children

def initialize
  @metadata         = {}
  @comment          = ''
  @parent           = nil
  @parent_name      = nil 
  @parent_class     = nil 
  @section          = nil
  @section_title    = nil 
  @file             = nil
  @full_name        = nil
  @store            = nil
  @track_visibility = true

  initialize_visibility
end
Public Instance Methods

display?() click to toggle source

Should this CodeObject be displayed in output?

A code object should be displayed if:

def display?
  @document_self and not @ignored and
    (documented? or not @suppressed)
end

document_children=(document_children) click to toggle source

Enables or disables documentation of this CodeObject’s children unless it has been turned off by :enddoc:

def document_children=(document_children)
  return unless @track_visibility

  @document_children = document_children unless @done_documenting
end

document_self=(document_self) click to toggle source

Enables or disables documentation of this CodeObject unless it has been turned off by :enddoc:. If the argument is nil it means the documentation is turned off by :nodoc:.

def document_self=(document_self)
  return unless @track_visibility
  return if @done_documenting

  @document_self = document_self
  @received_nodoc = true if document_self.nil?
end

documented?() click to toggle source

Does this object have a comment with content or is received_nodoc true?

def documented?
  @received_nodoc or !@comment.empty?
end

done_documenting=(value) click to toggle source

Turns documentation on/off, and turns on/off document_self and document_children.

Once documentation has been turned off (by :enddoc:), the object will refuse to turn document_self or document_children on, so :doc: and :start_doc: directives will have no effect in the current file.

def done_documenting=(value)
  return unless @track_visibility
  @done_documenting  = value
  @document_self     = !value
  @document_children = @document_self
end

each_parent() { |code_object| ... } click to toggle source

file_name() click to toggle source

force_documentation=(value) click to toggle source

Force the documentation of this object unless documentation has been turned off by :enddoc:

def force_documentation=(value)
  @force_documentation = value unless @done_documenting
end

full_name=(full_name) click to toggle source

Sets the full_name overriding any computed full name.

Set to nil to clear RDoc’s cached value

def full_name= full_name
  @full_name = full_name
end

ignore() click to toggle source

Use this to ignore a CodeObject and all its children until found again (record_location is called). An ignored item will not be displayed in documentation.

See github issue #55

The ignored status is temporary in order to allow implementation details to be hidden. At the end of processing a file RDoc allows all classes and modules to add new documentation to previously created classes.

If a class was ignored (via stopdoc) then reopened later with additional documentation it should be displayed. If a class was ignored and never reopened it should not be displayed. The ignore flag allows this to occur.

def ignore
  return unless @track_visibility

  @ignored = true

  stop_doc
end

ignored?() click to toggle source

Has this class been ignored?

See also ignore

def ignored?
  @ignored
end

options() click to toggle source

The options instance from the store this CodeObject is attached to, or a default options instance if the CodeObject is not attached.

This is used by Text#snippet

def options
  if @store and @store.rdoc then
    @store.rdoc.options
  else
    RDoc::Options.new
  end
end

parent() click to toggle source

Our parent CodeObject. The parent may be missing for classes loaded from legacy RI data stores.

def parent
  return @parent if @parent
  return nil unless @parent_name

  if @parent_class == RDoc::TopLevel then
    @parent = @store.add_file @parent_name
  else
    @parent = @store.find_class_or_module @parent_name

    return @parent if @parent

    begin
      @parent = @store.load_class @parent_name
    rescue RDoc::Store::MissingFileError
      nil
    end
  end
end

parent_file_name() click to toggle source

File name of our parent

def parent_file_name
  @parent ? @parent.base_name : '(unknown)'
end

parent_name() click to toggle source

Name of our parent

def parent_name
  @parent ? @parent.full_name : '(unknown)'
end

record_location(top_level) click to toggle source

Records the RDoc::TopLevel (file) where this code object was defined

def record_location top_level
  @ignored    = false
  @suppressed = false
  @file       = top_level
end

section() click to toggle source

The section this CodeObject is in. Sections allow grouping of constants, attributes and methods inside a class or module.

def section
  return @section if @section

  @section = parent.add_section @section_title if parent
end

start_doc() click to toggle source

Enable capture of documentation unless documentation has been turned off by :enddoc:

def start_doc
  return if @done_documenting

  @document_self = true
  @document_children = true
  @ignored    = false
  @suppressed = false
end

stop_doc() click to toggle source

Disable capture of documentation

def stop_doc
  return unless @track_visibility

  @document_self = false
  @document_children = false
end

store=(store) click to toggle source

Sets the store that contains this CodeObject

def store= store
  @store = store

  return unless @track_visibility

  if :nodoc == options.visibility then
    initialize_visibility
    @track_visibility = false
  end
end

suppress() click to toggle source

Use this to suppress a CodeObject and all its children until the next file it is seen in or documentation is discovered. A suppressed item with documentation will be displayed while an ignored item with documentation may not be displayed.

def suppress
  return unless @track_visibility

  @suppressed = true

  stop_doc
end

suppressed?() click to toggle source

Has this class been suppressed?

See also suppress

def suppressed?
  @suppressed
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4