Class: HtmlEmailCreator::Formatter
- Inherits:
-
Object
- Object
- HtmlEmailCreator::Formatter
show all
- Defined in:
- lib/html_email_creator/formatter.rb
Constant Summary
collapse
- @@DEFAULT =
HtmlEmailCreator::Formatters::UnknownFormatter
- @@CONFIG =
{}
Instance Method Summary
collapse
Constructor Details
#initialize(text, settings = HtmlEmailCreator.settings) ⇒ Formatter
Returns a new instance of Formatter.
16
17
18
19
|
# File 'lib/html_email_creator/formatter.rb', line 16
def initialize(text, settings = HtmlEmailCreator.settings)
@text = text
@settings = settings
end
|
Instance Method Details
#find(format) ⇒ Object
21
22
23
24
|
# File 'lib/html_email_creator/formatter.rb', line 21
def find(format)
klass = @@CONFIG[format.to_sym] || @@DEFAULT
klass.send(:new, @text, @settings)
end
|
#find_by_filename(filename) ⇒ Object
26
27
28
|
# File 'lib/html_email_creator/formatter.rb', line 26
def find_by_filename(filename)
find(File.extname(filename).split(".").last)
end
|