Class: Ame::Methods

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/ame/methods.rb

Instance Method Summary collapse

Constructor Details

#initializeMethods

Returns a new instance of Methods.



6
7
8
# File 'lib/ame/methods.rb', line 6

def initialize
  @methods = {}
end

Instance Method Details

#<<(method) ⇒ Object



10
11
12
13
# File 'lib/ame/methods.rb', line 10

def <<(method)
  @methods[method.name] = method
  self
end

#[](name) ⇒ Object



15
16
17
18
# File 'lib/ame/methods.rb', line 15

def [](name)
  @methods[name.to_sym] or
    raise Ame::UnrecognizedMethod, 'unrecognized method: %s' % name
end

#eachObject



24
25
26
27
28
29
# File 'lib/ame/methods.rb', line 24

def each
  @methods.each_value do |method|
    yield method
  end
  self
end

#include?(name) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/ame/methods.rb', line 20

def include?(name)
  @methods.include? name.to_sym
end