Guest User

Untitled

a guest
Jul 16th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. module ContactEventsHelper
  2. PARSE_HASH = { '$customer_name' => '@customer.primary_contact.first_name',
  3. '$logged_in_as' => 'current_user.name',
  4. '$business_name' => 'AppConfig.business_name',
  5. '$estimate_completed_at' => '@estimate_request.completed_at.to_s' }
  6.  
  7.  
  8. def script_for(dialog_type)
  9. parse_script AppConfig.contact_event_scripts[dialog_type.to_s]
  10. end
  11.  
  12. def parse_script(script)
  13. parsed_script = script.dup
  14. PARSE_HASH.each do |parse_key, parse_value|
  15. parsed_script[parse_key] = eval(parse_value) if script[parse_key]
  16. end
  17.  
  18. parsed_script
  19. end
  20.  
  21. end
Add Comment
Please, Sign In to add comment