A token to match an author year combination, breaks the string into three parts.
# File lib/splitter/tokens.rb, line 44 def initialize(str) str.strip! # check for parens if str =~ %r\((.*)\)/ w = $1 @parens = true else w = str @parens = false end # check for year if w =~ %r(\d\d\d\d)\Z/ @year = $1.to_i w.gsub!(%r\d\d\d\d\Z/, "") w.strip! end w.gsub!(%r,\s*\Z/, '') @authors = w.strip true end