Module: Interface

Defined in:
lib/interface.rb

Overview

A module for implementing Java style interfaces in Ruby. For more information about Java interfaces, please see:

java.sun.com/docs/books/tutorial/java/concepts/interface.html

Defined Under Namespace

Classes: MethodMissing

Constant Summary collapse

VERSION =

The version of this library.

'1.0.1'

Instance Method Summary collapse

Instance Method Details

#required_methods(*ids) ⇒ Object

Accepts an array of method names that define the interface. When this module is included/implemented, those method names must have already been defined.



48
49
50
# File 'lib/interface.rb', line 48

def required_methods(*ids)
   @ids = ids
end

#unrequired_methods(*ids) ⇒ Object

Accepts an array of method names that are removed as a requirement for implementation. Presumably you would use this in a sub-interface where you only wanted a partial implementation of an existing interface.



56
57
58
59
# File 'lib/interface.rb', line 56

def unrequired_methods(*ids)
   @unreq ||= []
   @unreq += ids
end