lib/picky/query/tokens.rb in picky-0.9.4 vs lib/picky/query/tokens.rb in picky-0.10.0

- old
+ new

@@ -4,15 +4,10 @@ # This class primarily handles switching through similar token constellations. # class Tokens - # - # - cattr_accessor :maximum - self.maximum = 5 - # Basically delegates to its internal tokens array. # self.delegate *[Enumerable.instance_methods, :slice!, :[], :uniq!, :last, :reject!, :length, :size, :empty?, :each, :exit, { :to => :@tokens }].flatten # @@ -50,16 +45,14 @@ @tokens.last.partial = true unless empty? end # Caps the tokens to the maximum. # - # Note: We could parametrize this if necessary. - # - def cap - @tokens.slice!(@@maximum..-1) if cap? + def cap maximum + @tokens.slice!(maximum..-1) if cap?(maximum) end - def cap? - @tokens.size > @@maximum + def cap? maximum + @tokens.size > maximum end # Rejects blank tokens. # def reject \ No newline at end of file