Skip to content

Instantly share code, notes, and snippets.

@s4parke
Created August 1, 2017 08:10
Show Gist options
  • Save s4parke/95193530ed89de9ed8a93cbed119a8e9 to your computer and use it in GitHub Desktop.
Save s4parke/95193530ed89de9ed8a93cbed119a8e9 to your computer and use it in GitHub Desktop.
Use ruby here documents with indentation
Use here documents with indentation
===================================
Thanks to [@dhamidi](https://github.com/dhamidi)
```ruby
# somewhere in your code
# make sure to use tabs!
def some_method
<<-EOF.gsub(/^\t/, '')
#+title: A document with metadata
#+created_at: 2014-03-01 12:56:31 CET
# The first headline
A paragraph.
#+with: no metadata
EOF
end
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment