Class: YARD::CodeObjects::ModuleObject

Inherits:
NamespaceObject show all
Defined in:
lib/yard/code_objects/module_object.rb

Overview

Represents a Ruby module.

Direct Known Subclasses

RootObject

Instance Attribute Summary

Attributes inherited from NamespaceObject

#aliases, #attributes, #child, #children, #class_attributes, #class_mixins, #constants, #cvars, #groups, #included_constants, #included_meths, #instance_attributes, #instance_mixins, #meths, #mixins

Attributes inherited from Base

#docstring, #dynamic, #files, #group, #namespace, #signature, #source, #source_type, #visibility

Instance Method Summary collapse

Methods inherited from NamespaceObject

#initialize

Methods inherited from Base

===, #[], #[]=, #add_file, #dynamic?, #equal?, #file, #format, #format_source, #has_tag?, #hash, #initialize, #inspect, #line, #method_missing, #name, new, #path, #relative_path, #root?, #sep, #tag, #tags, #type

Constructor Details

This class inherits a constructor from YARD::CodeObjects::NamespaceObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class YARD::CodeObjects::Base

Instance Method Details

#inheritance_tree(include_mods = false) ⇒ Array<NamespaceObject>

Returns the inheritance tree of mixins.

Parameters:

  • include_mods (Boolean) (defaults to: false)

    if true, will include mixed in modules (which is likely what is wanted).

Returns:



9
10
11
12
13
14
15
16
# File 'lib/yard/code_objects/module_object.rb', line 9

def inheritance_tree(include_mods = false)
  return [self] unless include_mods
  [self] + mixins(:instance, :class).map do |m|
    next if m == self
    next m unless m.respond_to?(:inheritance_tree)
    m.inheritance_tree(true)
  end.compact.flatten.uniq
end