Class: HtmlEmailCreator::EmailVersion
- Inherits:
-
Object
- Object
- HtmlEmailCreator::EmailVersion
- Defined in:
- lib/html_email_creator/email_version.rb
Instance Method Summary collapse
- #get ⇒ Object
- #id ⇒ Object
-
#initialize(formatter, output_basename, settings) ⇒ EmailVersion
constructor
A new instance of EmailVersion.
- #save ⇒ Object
Constructor Details
#initialize(formatter, output_basename, settings) ⇒ EmailVersion
Returns a new instance of EmailVersion.
3 4 5 6 7 |
# File 'lib/html_email_creator/email_version.rb', line 3 def initialize(formatter, output_basename, settings) @formatter = formatter @output_basename = output_basename @settings = settings end |
Instance Method Details
#get ⇒ Object
9 10 11 |
# File 'lib/html_email_creator/email_version.rb', line 9 def get @formatter.format end |
#id ⇒ Object
13 14 15 |
# File 'lib/html_email_creator/email_version.rb', line 13 def id @formatter.id end |
#save ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/html_email_creator/email_version.rb', line 17 def save file = File.join(@settings.output_path, "#{@output_basename}.#{@formatter.extension}") directory = File.dirname(file) FileUtils.mkdir_p(directory) unless File.exists?(directory) File.open(file, "w") do |opened_file| opened_file.write(get) end file end |