Class: Solid::LiquidExtensions::Variable

Inherits:
Liquid::Variable
  • Object
show all
Extended by:
ClassHighjacker
Defined in:
lib/solid/liquid_extensions/variable.rb

Instance Method Summary collapse

Methods included from ClassHighjacker

demodulized_name, load!, unload!

Constructor Details

#initialize(markup) ⇒ Variable

Returns a new instance of Variable.



6
7
8
9
# File 'lib/solid/liquid_extensions/variable.rb', line 6

def initialize(markup)
  super
  @expression = Solid::Parser.parse(@name)
end

Instance Method Details

#render(context) ⇒ Object



11
12
13
14
15
# File 'lib/solid/liquid_extensions/variable.rb', line 11

def render(context)
  return '' if @name.nil?
  value = @expression.evaluate(context)
  apply_filters_on(value, context)
end