CodeOfficer (owner)

Fork Of

Revisions

gist: 72141 Download_button fork
public
Public Clone URL: git://gist.github.com/72141.git
Embed All Files: show embed
Text only #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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 }}