Sha256: 8cf00b7456a27bd7f2e683bcddc076d391744407114a458240dface5711c06cd

Contents?: true

Size: 455 Bytes

Versions: 2

Compression:

Stored size: 455 Bytes

Contents

require 'rubygems'
require 'bundler'
require 'set'
require 'dna'
require 'progressbar'
require 'thor'

Dir.glob(File.join(File.dirname(__FILE__), 'lederhosen', '*.rb')).each { |f| require f }

##
# Here I extend the string class to add the to_kmers method
#
# Does it really need to be a method of String? Sure, why not?
#
class String
  def to_kmers(k)
    return [] if k == 0
    k -= 1
    (0..(self.length-k-1)).collect { |i| self[i..i+k] }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lederhosen-1.4.0 lib/lederhosen.rb
lederhosen-1.3.10 lib/lederhosen.rb