lib/picky/extensions/symbol.rb in picky-0.9.0 vs lib/picky/extensions/symbol.rb in picky-0.9.1
- old
+ new
@@ -3,32 +3,32 @@
class Symbol
# :keys.subtokens # => [:keys, :key, :ke, :k]
# :keys.subtokens(2) # => [:keys, :key, :ke]
#
- def subtokens down_to_length = 1
+ def subtokens from_length = 1
sub = self.id2name
size = sub.size
- down_to_length = size + down_to_length if down_to_length < 0
- down_to_length = size if size < down_to_length
+ from_length = size + from_length if from_length < 0
+ from_length = size if size < from_length
result = [self]
- size.downto(down_to_length + 1) { result << sub.chop!.intern }
+ size.downto(from_length + 1) { result << sub.chop!.intern }
result
end
# TODO Duplicate code.
#
- def each_subtoken down_to_length = 1
+ def each_subtoken from_length = 1
sub = self.id2name
size = sub.size
- down_to_length = size + down_to_length + 1 if down_to_length < 0
- down_to_length = size if size < down_to_length
- down_to_length = 1 if down_to_length < 1
+ from_length = size + from_length + 1 if from_length < 0
+ from_length = size if size < from_length
+ from_length = 1 if from_length < 1
yield self
- size.downto(down_to_length + 1) { yield sub.chop!.intern }
+ size.downto(from_length + 1) { yield sub.chop!.intern }
end
end
\ No newline at end of file