Class: MarkupEmail::Convert
- Inherits:
-
Object
- Object
- MarkupEmail::Convert
- Defined in:
- lib/markup_email.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
Instance Method Summary collapse
-
#initialize(file, title, sanitize = false) ⇒ Convert
constructor
A new instance of Convert.
- #write(name = String.new) ⇒ Object
Constructor Details
#initialize(file, title, sanitize = false) ⇒ Convert
Returns a new instance of Convert.
9 10 11 12 13 14 15 16 17 |
# File 'lib/markup_email.rb', line 9 def initialize file, title, sanitize=false @file = file body = Render.new(@file, sanitize).body = HTMLify.new(body) .title = title .documentize . @content = Styler.github_md(.content) end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
7 8 9 |
# File 'lib/markup_email.rb', line 7 def content @content end |
Instance Method Details
#write(name = String.new) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/markup_email.rb', line 19 def write name=String.new ext_split = File.basename(@file).split('.') new_file = name new_file = "#{ext_split[0, ext_split.length - 1][0]}-email.#{ext_split[-1]}.html" if name.empty? File.open("#{File.dirname(@file)}/#{new_file}", 'w') { |file| file.write @content } end |