class Ame::Methods

Stores {Methods#each each} {Method} defined on a {Class}. @api developer

Public Class Methods

new() click to toggle source
# File lib/ame-1.0/methods.rb, line 7
def initialize
  @methods = {}
end

Public Instance Methods

<<(method) click to toggle source

Adds METHOD to the receiver @param [Method] method @return [self]

# File lib/ame-1.0/methods.rb, line 14
def <<(method)
  @methods[method.name] = method
  self
end
[](name) click to toggle source

@return [Method] The method NAME in the receiver @raise [UnrecognizedMethod] If NAME isn’t a method in the receiver

# File lib/ame-1.0/methods.rb, line 21
def [](name)
  @methods[name] or
    raise Ame::UnrecognizedMethod, 'unrecognized method: %s' % name
end
each() { |method| ... } click to toggle source

@overload

Enumerates the methods.

@yieldparam [Method] option

@overload

@return [Enumerator<Method>] An Enumerator over the methods
# File lib/ame-1.0/methods.rb, line 32
def each
  return enum_for(__method__) unless block_given?
  @methods.each_value do |method|
    yield method
  end
  self
end