Class: Module

Inherits:
Object show all
Defined in:
lib/rio/abstract_method.rb

Overview

:nodoc: all

Instance Method Summary collapse

Instance Method Details

#abstract_method(*syms) ⇒ Object

abstract_method(symbol, …) extends Module defines a method which raises AbstractMethodCalled used in a base class to ensure that subclasses define an implementation

thus making the base class abstract


35
36
37
38
39
40
41
42
43
# File 'lib/rio/abstract_method.rb', line 35

def abstract_method(*syms)
  for symbol in syms
    module_eval "  def \#{symbol.id2name}(*args)\n        raise AbstractMethodCalled\n  end\n    end_eval\n  end\nend\n"