Sha256: 8c67c230e12638d52ac2e718f1a618e3097fb408a43f9461c9a2aaebe9365ad1

Contents?: true

Size: 365 Bytes

Versions: 7

Compression:

Stored size: 365 Bytes

Contents

# http://stackoverflow.com/questions/3772864/how-do-i-remove-leading-whitespace-chars-from-ruby-heredoc

class String
  # Strip leading whitespace from each line that is the same as the 
  # amount of whitespace on the first line of the string.
  # Leaves _additional_ indentation on later lines intact.
  def unindent
    gsub /^#{self[/\A[ \t]*/]}/, ''
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tla-sbuilder-0.3.9 lib/utils/string_inject.rb
tla-sbuilder-0.3.8 lib/utils/string_inject.rb
tla-sbuilder-0.3.7 lib/utils/string_inject.rb
tla-sbuilder-0.3.4 lib/utils/string_inject.rb
tla-sbuilder-0.2.2 lib/utils/string_inject.rb
tla-sbuilder-0.2.1 lib/utils/string_inject.rb
tla-sbuilder-0.1.0 lib/utils/string_inject.rb