Sha256: 87db2e5eef0a8813e346d31e586e6c47c6eccab0061c955f56a7a484f11d64ad

Contents?: true

Size: 326 Bytes

Versions: 10

Compression:

Stored size: 326 Bytes

Contents

##
# Removes indentation
#
# @example
#   help <<-EOS.undent
#     Here my help usage
#      sample_code
#
#     Fix
#   EOS
#   puts help.red.bold
#
class String
  # Strip unnecessary indentation of the front of a string
  def undent
    warn "##{__method__} is deprecated"
    gsub(/^.{#{slice(/^ +/).size}}/, '')
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
padrino-support-0.12.9 lib/padrino-support/core_ext/string/undent.rb
padrino-support-0.12.8.1 lib/padrino-support/core_ext/string/undent.rb
padrino-support-0.12.8 lib/padrino-support/core_ext/string/undent.rb
padrino-support-0.12.7 lib/padrino-support/core_ext/string/undent.rb
padrino-support-0.12.6 lib/padrino-support/core_ext/string/undent.rb
padrino-support-0.12.5 lib/padrino-support/core_ext/string/undent.rb
padrino-support-0.12.4 lib/padrino-support/core_ext/string/undent.rb
padrino-support-0.12.3 lib/padrino-support/core_ext/string/undent.rb
padrino-support-0.12.2 lib/padrino-support/core_ext/string/undent.rb
padrino-support-0.12.1 lib/padrino-support/core_ext/string/undent.rb