Skip to content

Instantly share code, notes, and snippets.

@aaronbbrown
Created April 12, 2012 15:15
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 aaronbbrown/2368044 to your computer and use it in GitHub Desktop.
Save aaronbbrown/2368044 to your computer and use it in GitHub Desktop.
How to test an erb
1 [11:13:09] aaron@gaeta-wifi:~$ cat /tmp/foo.erb
my name is <%= name %>
0 [11:13:14] aaron@gaeta-wifi:~$ erb -x -T '-' /tmp/foo.erb > /tmp/foo.rb
0 [11:13:37] aaron@gaeta-wifi:~$ vim !$
#!/usr/bin/env ruby
name = "Aaron" # ADD THIS
_erbout = ''; _erbout.concat "my name is "; _erbout.concat(( name ).to_s); _erbout.concat "\
n"
; _erbout.concat "\n"
; _erbout
puts _erbout # ADD THIS
0 [11:14:43] aaron@gaeta-wifi:~$ ruby !$
ruby /tmp/foo.rb
my name is Aaron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment