Sha256: 132bcbce36ccd59b51c566c180c760b959fe332261f6d369ca9e16361511fa2c
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 KB
Contents
## String#unindent require 'facets/string/unindent' We will use these two strings as a common basis for demonstration. ex1 = <<-EOF.gsub(/^\s*\|/,'') | I must go down to the seas again | The lonely sea and the sky | And all I want is a tall ship | And a star to steer her by EOF ex2 = <<-EOF.gsub(/^\s*\|/,'') | "Eek!" | She cried | As the mouse quietly scurried |by. EOF simple examples " xyz".unindent(-1).assert == " xyz" " xyz".unindent(0).assert == " xyz" " xyz".unindent(1).assert == " xyz" " xyz".unindent(2).assert == " xyz" " xyz".unindent(3).assert == "xyz" " xyz".unindent(4).assert == "xyz" large example unindented one space expected = <<-EOF.gsub(/^\s*\|/,'') | I must go down to the seas again | The lonely sea and the sky | And all I want is a tall ship | And a star to steer her by EOF actual = ex1.unindent(1) actual.assert == expected large example unindented four spaces expected = <<-EOF.gsub(/^\s*\|/,'') |I must go down to the seas again | The lonely sea and the sky |And all I want is a tall ship | And a star to steer her by EOF actual = ex1.unindent(4) actual.assert == expected unindent larger than current indention expected = <<-EOF.gsub(/^\s*\|/,'') |"Eek!" |She cried |As the mouse quietly scurried |by. EOF actual = ex2.unindent(100) actual.assert == expected
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
facets-glimmer-3.2.0 | demo/core/string/unindent.md |
facets-3.1.0 | demo/core/string/unindent.md |