How can I optimize this for memory?
def from_template(template, name, uid = nil)
template.dup.tap do |new|
new.template = template
new.tenant = tenant
new.program_constraint = updated_program_constraint(template)
end
end
def updated_program_constraint(template)
new_template = template.program_constraint.try(:dup)
new_template.valid_date_times[0]['end'] = 1.year.since(tenant.get_tz.now) if new_template.valid_date_times[0]['end'].past?
new_template
end