Ruby method to unindent strings.
Ruby
Switch branches/tags
Nothing to show
Latest commit 51b6fe6 Sep 30, 2011 @mynyml v1.0
Permalink
Failed to load latest commit information.
lib Handle empty strings Sep 30, 2011
test Handle empty strings Sep 30, 2011
.gitignore Simplify gem handling Jan 8, 2010
LICENSE License. Mar 16, 2009
Manifest Update README Jan 8, 2010
README.md Update README Sep 30, 2011
Rakefile Simplify gem handling Jan 8, 2010
examples.rb Update examples Jan 8, 2010
specs.watchr Add specs.watchr script Jan 8, 2010
unindent.gemspec v1.0 Sep 30, 2011

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