Skip to content

Instantly share code, notes, and snippets.

@jamesmanning
Created April 25, 2012 05:25
Show Gist options
  • Save jamesmanning/2486751 to your computer and use it in GitHub Desktop.
Save jamesmanning/2486751 to your computer and use it in GitHub Desktop.
ruby flexible quoting adds initial newline that here-doc does not
def test_old_style_here_doc
here_doc_style = <<WHEE
foo
bar
WHEE
flexible_quote_style = %{
foo
bar
}
assert_equal 8, here_doc_style.length
assert_equal 2, here_doc_style.lines.count
assert_equal "foo\nbar\n", here_doc_style
assert_equal 9, flexible_quote_style.length
assert_equal 3, flexible_quote_style.lines.count
assert_equal "\nfoo\nbar\n", flexible_quote_style
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment