Skip to content

Instantly share code, notes, and snippets.

@mrb

mrb/erb.rb

Last active May 23, 2016
Embed
What would you like to do?
class ShoppingList
attr_accessor :items
def initialize(items)
@items = items
end
# Expose private binding() method.
def get_binding
binding()
end
end
list = ShoppingList.new(items)
renderer = ERB.new(template)
puts output = renderer.result(list.get_binding)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment