Sha256: 2dea4728b7e7fb9964959c5028e17dc44aaa8702cb97870a948c71eea37da533
Contents?: true
Size: 540 Bytes
Versions: 2
Compression:
Stored size: 540 Bytes
Contents
unless "".respond_to?(:lines) class String # This version of String#lines is almost fully compatible with that # of Ruby 1.9. If a zero-length record separator is supplied in Ruby # 1.9, the string is split into paragraphs delimited by multiple # successive newlines. This replacement ignores that feature in # favor of code simplicity. def lines(separator = $/) result = split(separator).map { |part| "#{part}#{separator}" } result.each { |r| yield r } if block_given? result end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ohm-0.0.32 | lib/ohm/compat-1.8.6.rb |
ohm-0.0.31 | lib/ohm/compat-1.8.6.rb |