Class: Slippers::ApplyAttributeToTemplateNode

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/engine/slippers_nodes.rb

Instance Method Summary collapse

Instance Method Details

#eval(object_to_render, template_group) ⇒ Object



92
93
94
# File 'lib/engine/slippers_nodes.rb', line 92

def eval(object_to_render, template_group)
  [object_to_render].flatten.inject('') { |rendered, item| rendered + find_attribute_and_render(item, template_group) }
end

#find_attribute_and_render(item, template_group) ⇒ Object



96
97
98
99
# File 'lib/engine/slippers_nodes.rb', line 96

def find_attribute_and_render(item, template_group)
  object_to_render = attribute.value_of(item, template_group)
  [object_to_render].flatten.inject('') { |rendered, i| rendered + template.apply_attribute_to_subtemplate(i, template_group).to_s }
end