Module: ObjectTemplate

Included in:
DamageControl::Project
Defined in:
lib/damagecontrol/project.rb

Instance Method Summary collapse

Instance Method Details

#dupe(variables) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/damagecontrol/project.rb', line 16

def dupe(variables)
  template_yaml = YAML::dump(self)
  b = binding
  variables.each { |key, value| eval "#{key} = variables[\"#{key}\"]", b }
  new_yaml = eval(template_yaml.dump.gsub(/\\#/, "#"), b)
  YAML::load(new_yaml)
end