Class: IsbnValidatorFactory
- Inherits:
-
Object
- Object
- IsbnValidatorFactory
- Defined in:
- lib/IsbnValidatorFactory.rb
Class Method Summary collapse
Class Method Details
.getIsbnValidator(isbn) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/IsbnValidatorFactory.rb', line 12 def self.getIsbnValidator(isbn) strippedIsbn = isbn.gsub(/[^0-9a-z]/i,'') if strippedIsbn.length == 10 return Isbn10DigitValidator.new(strippedIsbn) elsif strippedIsbn.length == 13 return Isbn13DigitValidator.new(strippedIsbn) else return false end end |