Class: H2o::VariableNode
Instance Method Summary collapse
-
#initialize(name, filters) ⇒ VariableNode
constructor
A new instance of VariableNode.
- #render(context, stream) ⇒ Object
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 |