Class: Gtiny::ISBN13
Overview
ISBN-13: Used for all books published on or after January 1st, 2007.
Class Method Summary collapse
-
.regex ⇒ Object
The ISBN-13 format consists of 5 groups, separated by hyphens (or spaces).
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
.regex ⇒ Object
The ISBN-13 format consists of 5 groups, separated by hyphens (or spaces).
-
The prefix element, 3 digits - so far only 978 and 979 are used.
-
The group identifier, up to five digits
-
The publisher identifier, up to seven digits
-
The title identifier, up to 6 digits
-
The check digit
15 16 17 |
# File 'lib/gtiny/isbn13.rb', line 15 def self.regex /\A97(?:8|9)[- ]?[0-9]{1,5}[- ]?[0-9]{1,7}[- ]?[0-9]{1,6}[- ]?[0-9]\z/ end |
Instance Method Details
#prefix_element ⇒ Object
23 24 25 26 27 |
# File 'lib/gtiny/isbn13.rb', line 23 def prefix_element check_number_of_groups! groups[0] end |
#type ⇒ Object
19 20 21 |
# File 'lib/gtiny/isbn13.rb', line 19 def type "ISBN-13" end |