Class: HtmlEmailCreator::EmailCreator

Inherits:
Object
  • Object
show all
Defined in:
lib/html_email_creator/email_creator.rb

Instance Method Summary collapse

Instance Method Details

#create_all_email_versions(file_or_configuration) ⇒ Object



15
16
17
# File 'lib/html_email_creator/email_creator.rb', line 15

def create_all_email_versions(file_or_configuration)
  email(file_or_configuration).render_all
end

#create_email(file_or_configuration, format) ⇒ Object



3
4
5
# File 'lib/html_email_creator/email_creator.rb', line 3

def create_email(file_or_configuration, format)
  email(file_or_configuration).render_only(format)
end

#create_html_email(file_or_configuration) ⇒ Object



7
8
9
# File 'lib/html_email_creator/email_creator.rb', line 7

def create_html_email(file_or_configuration)
  email(file_or_configuration).render_html_email
end

#create_plain_text_email(file_or_configuration) ⇒ Object



11
12
13
# File 'lib/html_email_creator/email_creator.rb', line 11

def create_plain_text_email(file_or_configuration)
  email(file_or_configuration).render_plain_text_email
end

#save_email(file_or_configuration) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/html_email_creator/email_creator.rb', line 19

def save_email(file_or_configuration)
  formats_and_paths = {}
  create_all_email_versions(file_or_configuration).each_value do |version|
    formats_and_paths[version.id] = version.save
  end
  formats_and_paths
end

#save_emails(file_or_directory, recursively = false) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/html_email_creator/email_creator.rb', line 27

def save_emails(file_or_directory, recursively = false)
  files = {}
  HtmlEmailCreator::Email.find_emails(file_or_directory, recursively).each do |file|
    files[file] = save_email(file)
  end
  files
end