Class | YARD::CodeObjects::NamespaceObject
In: | lib/yard/code_objects/namespace_object.rb
Parent: | Base

A "namespace" is any object that can store other objects within itself. The two main Ruby objects that can act as namespaces are modules ({ModuleObject}) and classes ({ClassObject}).

### Methods

child class_attributes constants cvars included_constants included_meths instance_attributes meths mixins new

### Attributes

aliases | [R] | A hash containing two keys, :class and :instance, each containing a hash of objects and their alias names. @return [Hash] a list of methods

attributes

[R]

A hash containing two keys, class and instance, each containing the attribute name with a { :read, :write } hash for the read and write objects respectively.

@example The attributes of an object

      >> Registry.at('YARD::Docstring').attributes
      => {
            :class => { },
            :instance => {
              :ref_tags => {
                :read => #<yardoc method YARD::Docstring#ref_tags>,
                :write => nil
              },
              :object => {
                :read => #<yardoc method YARD::Docstring#object>,
                :write => #<yardoc method YARD::Docstring#object=>
               },
               ...
            }
          }

@return [Hash] a list of methods

child | [W] |
children | [R] | The list of objects defined in this namespace @return [Array<Base>] a list of objects
class_attributes | [W] |
class_mixins | [R] | Class mixins @return [Array<ModuleObject>] a list of mixins
constants | [W] |
cvars | [W] |
groups | [RW] | @return [Array<String>] a list of ordered group names inside the namespace @since 0.6.0
included_constants | [W] |
included_meths | [W] |
instance_attributes | [W] |
instance_mixins | [R] | Instance mixins @return [Array<ModuleObject>] a list of mixins
meths | [W] |
mixins | [W] |

### Public Class methods

new(namespace, name, *args, &block)

Creates a new namespace object inside `namespace` with `name`. @see Base#initialize

### Public Instance methods

child(opts = {})

Looks for a child that matches the attributes specified by `opts`.

@example Finds a child by name and scope

      namespace.child(:name => :to_s, :scope => :instance)
      # => #<yardoc method MyClass#to_s>

@return [Base, nil] the first matched child object, or nil

class_attributes()

Only the class attributes @return [Hash] a list of method names and their read/write objects @see attributes

constants(opts = {})

Returns all constants in the namespace

@option opts [Boolean] :included (true) whether or not to include

      mixed in constants in list

@return [Array<ConstantObject>] a list of constant objects

cvars()

Returns class variables defined in this namespace. @return [Array<ClassVariableObject>] a list of class variable objects

included_constants()

Returns constants included from any mixins @return [Array<ConstantObject>] a list of constant objects

included_meths(opts = {})

Returns methods included from any mixins that match the attributes specified by `opts`. If no options are specified, returns all included methods.

@option opts [Array<Symbol>, Symbol] :visibility ([:public, :private,

      :protected]) the visibility of the methods to list. Can be an array or
      single value.

@option opts [Array<Symbol>, Symbol] :scope ([:class, :instance]) the

      scope of the methods to list. Can be an array or single value.

@option opts [Boolean] :included (true) whether to include mixed in

      methods in the list.

@see meths

instance_attributes()

Only the instance attributes @return [Hash] a list of method names and their read/write objects @see attributes

meths(opts = {})

Returns all methods that match the attributes specified by `opts`. If no options are provided, returns all methods.

@example Finds all private and protected class methods

      namespace.meths(:visibility => [:private, :protected], :scope => :class)
      # => [#<yardoc method MyClass.privmeth>, #<yardoc method MyClass.protmeth>]

@option opts [Array<Symbol>, Symbol] :visibility ([:public, :private,

      :protected]) the visibility of the methods to list. Can be an array or
      single value.

@option opts [Array<Symbol>, Symbol] :scope ([:class, :instance]) the

      scope of the methods to list. Can be an array or single value.

@option opts [Boolean] :included (true) whether to include mixed in

      methods in the list.

@return [Array<MethodObject>] a list of method objects

mixins(*scopes)

Returns for specific scopes. If no scopes are provided, returns all mixins. @param [Array<Symbol>] scopes a list of scopes (:class, :instance) to

      return mixins for. If this is empty, all scopes will be returned.

@return [Array<ModuleObject>] a list of mixins

[Validate]