Sha256: 4f4802e856cbfcbe73a8c856edda74c2d651cf1cd77b95f21863e854b353f465
Contents?: true
Size: 445 Bytes
Versions: 1
Compression:
Stored size: 445 Bytes
Contents
require "facets/enumerator" class String # Returns an Enumerator for iterating over each # line of the string, stripped of whitespace on # either side. # def cleanlines(&block) if block scan(/^.*?$/) do |line| block.call(line.strip) end else str = self Enumerator.new do |output| str.scan(/^.*?$/) do |line| output.yield(line.strip) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
facets-2.9.0.pre.1 | lib/core/facets/string/cleanlines.rb |