Sha256: 93e51c4b6141aacf66ff4a81a18d3f313953c3921609d908fcf98297b3dce14f

Contents?: true

Size: 350 Bytes

Versions: 10

Compression:

Stored size: 350 Bytes

Contents

class String

  # Matches any whitespace (including newline) and replaces with a single space
  #
  #   string = <<-QUERY.compress_lines
  #     SELECT name
  #     FROM users
  #   QUERY
  #
  #   string  #=> "SELECT name FROM users"
  #
  def compress_lines(spaced = true)
    split($/).map{ |line| line.strip }.join(spaced ? ' ' : '')
  end

end

Version data entries

10 entries across 9 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/string/compress_lines.rb
facets-3.1.0 lib/core/facets/string/compress_lines.rb
facets-3.0.0 lib/core/facets/string/compress_lines.rb
facets-2.9.3 lib/core/facets/string/compress_lines.rb
facets-2.9.2 src/core/facets/string/compress_lines.rb
facets-2.9.2 lib/core/facets/string/compress_lines.rb
facets-2.9.1 lib/core/facets/string/compress_lines.rb
facets-2.9.0 lib/core/facets/string/compress_lines.rb
facets-2.9.0.pre.2 lib/core/facets/string/compress_lines.rb
facets-2.9.0.pre.1 lib/core/facets/string/compress_lines.rb