lib/picky/query/tokens.rb in picky-4.18.0 vs lib/picky/query/tokens.rb in picky-4.19.0

- old
+ new

@@ -5,11 +5,11 @@ module Query # This class primarily handles switching through similar token constellations. # class Tokens - + attr_reader :tokens, :ignore_unassigned # Basically forwards to its internal tokens array. # forward *[Enumerable.instance_methods, :slice!, :[], :uniq!, :last, :reject!, :length, :size, :empty?, :each, :exit, :to => :@tokens].flatten @@ -23,14 +23,16 @@ @ignore_unassigned = ignore_unassigned end # Creates a new Tokens object from a number of Strings. # + @@or_splitting_pattern = /\|/ + @@splitter = Splitter.new @@or_splitting_pattern def self.processed words, originals, ignore_unassigned = false new(words.zip(originals).collect! do |word, original| - w, *middle, rest = word.split(/\|/) + w, *middle, rest = @@splitter.multi word if rest - Or.new processed [w, *middle, rest], original.split(/\|/) + Or.new processed [w, *middle, rest], original.split(@@or_splitting_pattern) else Token.processed w, original end end, ignore_unassigned) end \ No newline at end of file