Module: ValidArray
- Defined in:
- lib/valid-array.rb,
lib/valid-array/functions.rb
Overview
Namespace ValidArray
Defined Under Namespace
Modules: Functions Classes: UnexpectedTypeException
Class Method Summary collapse
-
.extended(mod) ⇒ Object
Hook the extension process in order to include the necessary functions and do some basic sanity checks.
Instance Method Summary collapse
-
#validate(element) ⇒ Object
Default validator.
Class Method Details
.extended(mod) ⇒ Object
Hook the extension process in order to include the necessary functions and do some basic sanity checks.
10 11 12 13 14 15 16 17 |
# File 'lib/valid-array.rb', line 10 def self.extended(mod) unless mod <= Array raise UnexpectedTypeException.new([Array], mod.class) end mod.module_exec(self::Functions) do |functions_module| include functions_module end end |
Instance Method Details
#validate(element) ⇒ Object
Default validator. Override this.
20 21 22 |
# File 'lib/valid-array.rb', line 20 def validate(element) raise NotImplementedError, "You must implement validate." end |