Class: Braai::Handlers::Iteration

Inherits:
Base
  • Object
show all
Defined in:
lib/braai/handlers/iteration.rb

Instance Attribute Summary

Attributes inherited from Base

#key, #matches, #template

Instance Method Summary collapse

Methods inherited from Base

call, #initialize, #rescue_from_error, #safe_perform

Constructor Details

This class inherits a constructor from Braai::Handlers::Base

Instance Method Details

#performObject



3
4
5
6
7
8
9
# File 'lib/braai/handlers/iteration.rb', line 3

def perform
  res = []
  template.attributes[matches[2]].each do |val|
    res << Braai::Context.new(matches[3], template, template.attributes.merge(matches[1] => val)).render
  end
  res.join("\n")
end