Class: LiquidPlugin
- Inherits:
-
Henshin::LayoutParser
- Object
- Henshin::StandardPlugin
- Henshin::LayoutParser
- LiquidPlugin
- Defined in:
- lib/henshin/plugins/liquid.rb
Instance Attribute Summary collapse
-
#extensions ⇒ Object
Returns the value of attribute extensions.
Attributes inherited from Henshin::StandardPlugin
Instance Method Summary collapse
- #generate(layout, data) ⇒ Object
-
#initialize ⇒ LiquidPlugin
constructor
A new instance of LiquidPlugin.
-
#read(file) ⇒ Object
returns the layout as a string.
Constructor Details
#initialize ⇒ LiquidPlugin
Returns a new instance of LiquidPlugin.
8 9 10 11 |
# File 'lib/henshin/plugins/liquid.rb', line 8 def initialize @extensions = {:input => [], :output => ''} end |
Instance Attribute Details
#extensions ⇒ Object
Returns the value of attribute extensions.
6 7 8 |
# File 'lib/henshin/plugins/liquid.rb', line 6 def extensions @extensions end |
Instance Method Details
#generate(layout, data) ⇒ Object
13 14 15 16 |
# File 'lib/henshin/plugins/liquid.rb', line 13 def generate( layout, data ) t = Liquid::Template.parse( read(layout) ) t.render(data) end |
#read(file) ⇒ Object
returns the layout as a string
19 20 21 22 23 24 25 26 |
# File 'lib/henshin/plugins/liquid.rb', line 19 def read( file ) f = File.open(file, "r") r = "" f.each do |l| r << l end r end |