Method: YARD::CodeObjects::NamespaceObject#included_meths

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

#included_meths(opts = {}) ⇒ Object

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

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :visibility (Array<Symbol>, Symbol) — default: [:public, :private, :protected]

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

  • :scope (Array<Symbol>, Symbol) — default: [:class, :instance]

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

  • :included (Boolean) — default: true

    whether to include mixed in methods in the list.

See Also:


144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/yard/code_objects/namespace_object.rb', line 144

def included_meths(opts = {})
  opts = SymbolHash[:scope => [:instance, :class]].update(opts)
  [opts[:scope]].flatten.map do |scope|
    mixins(scope).inject([]) do |list, mixin|
      next list if mixin.is_a?(Proxy)
      arr = mixin.meths(opts.merge(:scope => :instance)).reject do |o|
        next false if opts[:all]
        child(:name => o.name, :scope => scope) || list.find {|o2| o2.name == o.name }
      end
      arr.map! {|o| ExtendedMethodObject.new(o) } if scope == :class
      list + arr
    end
  end.flatten
end