Class: Ame::Methods
- Inherits:
-
Object
- Object
- Ame::Methods
- Includes:
- Enumerable
- Defined in:
- lib/ame-1.0/methods.rb
Overview
Instance Method Summary collapse
-
#<<(method) ⇒ self
Adds METHOD to the receiver.
-
#[](name) ⇒ Method
The method NAME in the receiver.
- #each ⇒ Object
-
#initialize ⇒ Methods
constructor
A new instance of Methods.
Constructor Details
#initialize ⇒ Methods
Returns a new instance of Methods.
8 9 10 |
# File 'lib/ame-1.0/methods.rb', line 8 def initialize @methods = {} end |
Instance Method Details
#<<(method) ⇒ self
Adds METHOD to the receiver
15 16 17 18 |
# File 'lib/ame-1.0/methods.rb', line 15 def <<(method) @methods[method.name] = method self end |
#[](name) ⇒ Method
Returns The method NAME in the receiver.
22 23 24 25 |
# File 'lib/ame-1.0/methods.rb', line 22 def [](name) @methods[name] or raise Ame::UnrecognizedMethod, 'unrecognized method: %s' % name end |
# {|option| ... } ⇒ Object # ⇒ Enumerator<Method>
33 34 35 36 37 38 39 |
# File 'lib/ame-1.0/methods.rb', line 33 def each return enum_for(__method__) unless block_given? @methods.each_value do |method| yield method end self end |