Skip to content

Instantly share code, notes, and snippets.

@lifo
Created July 8, 2009 13:41
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 lifo/142856 to your computer and use it in GitHub Desktop.
Save lifo/142856 to your computer and use it in GitHub Desktop.
require 'erb'
require 'ostruct'
module FuckingHelpers
def last
"from helper"
end
end
vars = OpenStruct.new :first => 'Mislav'
class << vars
include FuckingHelpers
end
template = 'Name: <%= first %> <%= last %>'
puts ERB.new(template).result(vars.send(:binding))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment