Sha256: c8fe5134dc18ec09cd1724ae85b991a2eed2ae4e645e595c38ce23cc0a21d49e
Contents?: true
Size: 382 Bytes
Versions: 2
Compression:
Stored size: 382 Bytes
Contents
class Guillaume::Poetics def self.enjamb(chance=100, line) if rand(100) <= chance line_parts = line.split(/(?<=[\.,;!-])/) if line_parts.count > 1 # if the line contains any . , ; ! - random_index = rand(line_parts.count) line_parts[random_index] = line_parts[random_index] + "\n" line_parts.join.strip end end line end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
guillaume-0.0.2 | lib/guillaume/poetics.rb |
guillaume-0.0.1 | lib/guillaume/poetics.rb |