Sha256: 68cf2e215cc2812fd3774cea977e530e07480bc165940c2597ac057c96d87b16
Contents?: true
Size: 378 Bytes
Versions: 8
Compression:
Stored size: 378 Bytes
Contents
# Extending the Symbol class. # class Symbol # :keys.subtokens # => [:key, :ke, :k] # :keys.subtokens(2) # => [:key, :ke] # def subtokens down_to_length = 1 sub, result = self.to_s, [self] size = sub.size down_to_length = size if size < down_to_length size.downto(down_to_length + 1) { result << sub.chop!.to_sym } result end end
Version data entries
8 entries across 8 versions & 1 rubygems