Sha256: cf500c1eba05af3bc50e5a5dfbe3ee89ec1029b6c30e94595db8a04d415bf275
Contents?: true
Size: 651 Bytes
Versions: 2
Compression:
Stored size: 651 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 unless Object.new.respond_to?(:tap) class Object def tap yield(self) self end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ohm-0.0.34 | lib/ohm/compat-1.8.6.rb |
ohm-0.0.33 | lib/ohm/compat-1.8.6.rb |