lib/picky/internals/query/tokens.rb in picky-2.1.0 vs lib/picky/internals/query/tokens.rb in picky-2.1.1
- old
+ new
@@ -12,14 +12,20 @@
# Basically delegates to its internal tokens array.
#
self.delegate *[Enumerable.instance_methods, :slice!, :[], :uniq!, :last, :reject!, :length, :size, :empty?, :each, :exit, { :to => :@tokens }].flatten
+ # Create a new Tokens object with the array of tokens passed in.
#
- #
def initialize tokens = []
@tokens = tokens
end
+
+ # Creates a new Tokens object from a number of Strings.
+ #
+ # Options:
+ # * downcase: Whether to downcase the passed strings (default is true)
+ #
def self.processed words, downcase = true
new words.collect! { |word| Token.processed word, downcase }
end
# Tokenizes each token.
\ No newline at end of file