Sha256: 7f60498041233cb89d031c2b15ed644261329171d25efc07d29e7bf4f7ed6889

Contents?: true

Size: 339 Bytes

Versions: 5

Compression:

Stored size: 339 Bytes

Contents

class String

  unless method_defined?(:lines)  # 1.8.7+

    # Returns an array of characters.
    #
    #   "abc\n123".lines  #=> ["abc\n","123"]
    #
    def lines(&blk)
      if block_given?
        each_line(&blk) #scan(/$.*?\n/).each(&blk)
      else
        Enumerator.new(self, :lines) #.split(/\n/)
      end
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
facets-2.8.4 lib/core/facets/string/lines.rb
facets-2.8.3 lib/core/facets/string/lines.rb
facets-2.8.2 lib/core/facets/string/lines.rb
facets-2.8.1 lib/core/facets/string/lines.rb
facets-2.8.0 lib/core/facets/string/lines.rb