Class: Ame::Methods
Instance Method Summary collapse
- #<<(method) ⇒ Object
- #[](name) ⇒ Object
- #each ⇒ Object
- #include?(name) ⇒ Boolean
-
#initialize ⇒ Methods
constructor
A new instance of Methods.
Constructor Details
#initialize ⇒ Methods
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 |
#each ⇒ Object
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
20 21 22 |
# File 'lib/ame/methods.rb', line 20 def include?(name) @methods.include? name.to_sym end |