Class: H2o::VariableNode

Inherits:
Node show all
Defined in:
lib/h2o/nodes.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, filters) ⇒ VariableNode

Returns a new instance of VariableNode.



53
54
55
56
# File 'lib/h2o/nodes.rb', line 53

def initialize (name, filters)
  @name = name
  @filters = filters.empty? ? nil : filters
end

Instance Method Details

#render(context, stream) ⇒ Object



58
59
60
61
62
# File 'lib/h2o/nodes.rb', line 58

def render(context, stream)
  variable = @name.is_a?(Symbol) ? context.resolve(@name) : @name
  variable = context.apply_filters(variable, @filters) if @filters
  stream << variable
end