Class: Gtiny::ISBN10

Inherits:
ISBN show all
Defined in:
lib/gtiny/isbn10.rb

Overview

ISBN-10: Used for books published before 2007.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ISBN

#check_digit, #group_identifier, normalize, #publisher_identifier, #title_identifier, #valid?

Methods inherited from Encoding

#initialize, matches?, normalize, #to_s, #valid?, #zeroes?

Constructor Details

This class inherits a constructor from Gtiny::Encoding

Class Method Details

.regexObject

The ISBN-10 format consists of 4 groups, separated by hyphens (or spaces).

  1. The group identifier, up to five digits

  2. The publisher identifier, up to seven digits

  3. The title identifier, up to 6 digits

  4. The check digit



14
15
16
# File 'lib/gtiny/isbn10.rb', line 14

def self.regex
  /\A[0-9]{1,5}[- ]?[0-9]{1,7}[- ]?[0-9]{1,6}[- ]?[0-9xX]\z/
end

Instance Method Details

#typeObject



18
19
20
# File 'lib/gtiny/isbn10.rb', line 18

def type
  "ISBN-10"
end