Skip to content
Ruby method to unindent strings.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
test
.gitignore
LICENSE
Manifest
README.md
Rakefile
examples.rb
specs.watchr
unindent.gemspec

README.md

Summary

Simple Ruby method, String#unindent, to unindent strings. Useful for multi-line strings embeded in already indented code.

Examples

class Profile
  def default_text
    <<-STR
      Anonymous Coward
        - Community Guest
    STR
  end
end

puts Profile.new.default_text
#      Anonymous Coward
#        - Community Guest

puts Profile.new.default_text.unindent
#Anonymous Coward
#  - Community Guest

Install

gem install unindent

You can’t perform that action at this time.