Skip to content

Instantly share code, notes, and snippets.

@tenderlove
Created November 24, 2010 19:20
Show Gist options
  • Save tenderlove/714221 to your computer and use it in GitHub Desktop.
Save tenderlove/714221 to your computer and use it in GitHub Desktop.
require 'erb'
class ERBIO < ERB
def set_eoutvar compiler, eoutvar
compiler.put_cmd = "#{eoutvar}.write"
compiler.insert_cmd = "#{eoutvar}.write"
compiler.pre_cmd = []
compiler.post_cmd = []
end
end
ioerb = ERBIO.new("<%= 'hello world' %>", nil, nil, '$stdout')
ioerb.result binding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment