Module: Digiproc::RequiresData

Defined in:
lib/concerns/requires_data.rb

Overview

Many modules in this gem require that the class which includes them has a property called ‘data`. This module can be used by modules which require the use of the `data` property to ensure that they are being used correctly. If `data` is not a property, a `TypeError` will be thrown upon inclusion into the class.

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Raises:

  • (TypeError)


5
6
7
# File 'lib/concerns/requires_data.rb', line 5

def self.included(base)
    raise TypeError.new("To implement #{self}, #{base} must have an instance varaible @data, and getters/setters") if not base.method_defined?(:data) 
end