Class YARD::CodeObjects::Base
In: lib/yard/code_objects/base.rb
Parent: Object

Methods

==   ===   []   []=   add_file   docstring=   dynamic?   file   format_source   has_tag?   inspect   line   method_missing   namespace=   new   new   parent=   path   sep   source=   tag   tags   to_s   type  

External Aliases

namespace -> parent

Attributes

docstring  [RW] 
dynamic  [RW] 
files  [R] 
name  [R] 
namespace  [RW] 
signature  [RW] 
source  [RW] 

Public Class methods

Public Instance methods

Associates a file with a code object, optionally adding the line where it was defined. By convention, ’<STDIN>’ should be used to associate code that comes form standard input.

@param [String] file the filename (’<STDIN>’ for standard input) @param [Fixnum, nil] the line number where the object lies in the file @param [Boolean] whether or not the definition has comments associated. This

  will allow {#file} to return the definition where the comments were made instead
  of any empty definitions that might have been parsed before (module namespaces for instance).

Attaches a docstring to a code oject by parsing the comments attached to the statement and filling the {tags} and {docstring} methods with the parsed information.

@param [String, Array<String>, Docstring] comments

  the comments attached to the code object to be parsed
  into a docstring and meta tags.

Returns the filename the object was first parsed at, taking definitions with docstrings first.

@return [String] a filename

Returns the line the object was first parsed at (or nil)

@return [Fixnum] the line where the object was first defined. @return [nil] if there is no line associated with the object

parent=(obj)

Alias for namespace=

Attaches source code to a code object with an optional file location

@param [source, String] statement

  the +Parser::Statement+ holding the source code or the raw source
  as a +String+ for the definition of the code object only (not the block)
to_s()

Alias for path

Default type is the lowercase class name without the "Object" suffix

Override this method to provide a custom object type

@return [Symbol] the type of code object this represents

Protected Instance methods

Formats source code by removing leading indentation

[Validate]