Class: Ruty::Datastructure::VariableNode

Inherits:
Node
  • Object
show all
Defined in:
lib/ruty/datastructure.rb

Overview

a node that stores a variable plus filters

Instance Method Summary collapse

Constructor Details

#initialize(name, filters) ⇒ VariableNode

Returns a new instance of VariableNode.


63
64
65
66
# File 'lib/ruty/datastructure.rb', line 63

def initialize name, filters
  @name = name
  @filters = filters
end

Instance Method Details

#render_node(context, stream) ⇒ Object


68
69
70
71
72
# File 'lib/ruty/datastructure.rb', line 68

def render_node context, stream
  value = context.apply_filters(context.resolve(@name), @filters).to_s
  stream << value if not value.empty?
  nil
end