Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save danlynn/4512649 to your computer and use it in GitHub Desktop.
Save danlynn/4512649 to your computer and use it in GitHub Desktop.
The following code provides an attractive and easy way to populate a hash with multi-line text values. These multi-line text literals are defined using ruby's here-doc syntax. In this case, the values are snippets of javascript code that were simply pasted in.
hash = {
:key1 => <<-END_VAL,
console.log('cow');
alert('moof!');
END_VAL
:key2 => <<-END_VAL
console.log('cow 2');
alert('moof! 2');
END_VAL
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment