Skip to content

Instantly share code, notes, and snippets.

@danmcclain
Forked from bcardarella/gist:1942296
Created February 29, 2012 16:44
Show Gist options
  • Save danmcclain/1942358 to your computer and use it in GitHub Desktop.
Save danmcclain/1942358 to your computer and use it in GitHub Desktop.
@user = User.new(:email => 'test@example.com', :name => 'John Wayne')
string = "hello there {{user.email}} how are you {{user.name}}"
string.gsub(/\{\{(.+?)\}\}/) do |s|
eval("@#{$1}")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment