Skip to content

Instantly share code, notes, and snippets.

@evanphx
Created May 17, 2012 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanphx/2720171 to your computer and use it in GitHub Desktop.
Save evanphx/2720171 to your computer and use it in GitHub Desktop.
hash = "abcdefg"
s = <<abcdefg.chomp
blah
abcdefg
p s
@steveklabnik
Copy link

Right. But I don't need to save it off to a variable... the string just needs to be in there. that's why the old code was just "#{str}";

@evanphx
Copy link
Author

evanphx commented May 17, 2012

oh right. You're probably embedding it directly in an expression. Heredocs are a pain because of that, they can't be in the middle of an expression.

@steveklabnik
Copy link

Okay, so that fundamentally won't work them. Hrm. Just pick a separator and then gsub it, you think?

@evanphx
Copy link
Author

evanphx commented May 17, 2012

Yep. I'd go with `. It's easy to see, gsub, and is rare.

@steveklabnik
Copy link

I had to go with ; because the `s were getting eval'd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment