Class: IsbnValidator
- Inherits:
-
Object
show all
- Defined in:
- lib/IsbnValidator.rb
Overview
The IsbnValidator class defines a template method called validate , which represent a workflow to follow. The validate method calls checkDigit and validateIsbn methods which have its custom implementation in the subclasses.
Constant Summary
collapse
- METHOD_MISSING =
"IsbnConverter SYSTEM ERROR: method missing"
Instance Method Summary
collapse
Instance Method Details
#checkDigit ⇒ Object
10
|
# File 'lib/IsbnValidator.rb', line 10
def checkDigit; raise METHOD_MISSING; end
|
#validate ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/IsbnValidator.rb', line 13
def validate
result = checkDigit()
if result == true
result = validateIsbn()
end
return result
end
|
#validateIsbn ⇒ Object
11
|
# File 'lib/IsbnValidator.rb', line 11
def validateIsbn; raise METHOD_MISSING; end
|