# Class: YARD::CodeObjects::ModuleObject

Inherits:
  NamespaceObject
  - Object
  - Base
  - NamespaceObject
  - YARD::CodeObjects::ModuleObject
  show all

Defined in:
  lib/yard/code_objects/module_object.rb

## Overview

Represents a Ruby module.

## Direct Known Subclasses

RootObject

## Instance Method Summary collapse

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

  Returns the inheritance tree of mixins.

## 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:

- (`Array<NamespaceObject>`) —

  a list of namespace objects

    12
    13
    14
    15
    16
    17
    18
    19

    # File 'lib/yard/code_objects/module_object.rb', line 12

    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