Skip to content

Instantly share code, notes, and snippets.

@CodeOfficer
Forked from anteaya/gist:72138
Created February 28, 2009 22:49
Show Gist options
  • Save CodeOfficer/72141 to your computer and use it in GitHub Desktop.
Save CodeOfficer/72141 to your computer and use it in GitHub Desktop.
require '../lib/liquid'
class User
attr_accessor :name
liquid_methods :name
def initialize(name)
@name = name
end
end
user = User.new('tobi')
file = File.new('sentence.liquid').read
puts Liquid::Template.parse(file).render('user' => user)
*****************************************************
# now in a sentence.liquid file
Hello {{ user.name }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment