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 the interface library.

'1.0.4'

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.



52
53
54
# File 'lib/interface.rb', line 52

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.



60
61
62
63
# File 'lib/interface.rb', line 60

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