Class: Asterisk::Mailcmd::Settings
- Inherits:
-
Object
- Object
- Asterisk::Mailcmd::Settings
- Includes:
- Singleton
- Defined in:
- lib/asterisk/mailcmd/settings.rb
Class Attribute Summary collapse
-
.html_tmpl ⇒ Object
Returns the value of attribute html_tmpl.
-
.text_tmpl ⇒ Object
Returns the value of attribute text_tmpl.
Class Method Summary collapse
-
.read(file, type = :html) ⇒ Object
reading config file.
Class Attribute Details
.html_tmpl ⇒ Object
Returns the value of attribute html_tmpl.
9 10 11 |
# File 'lib/asterisk/mailcmd/settings.rb', line 9 def html_tmpl @html_tmpl end |
.text_tmpl ⇒ Object
Returns the value of attribute text_tmpl.
10 11 12 |
# File 'lib/asterisk/mailcmd/settings.rb', line 10 def text_tmpl @text_tmpl end |
Class Method Details
.read(file, type = :html) ⇒ Object
reading config file
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/asterisk/mailcmd/settings.rb', line 13 def read(file, type = :html) raise ArgumentError, "Config file #{file} does not exists" unless File.exists? file raise ArgumentError, "Can not read config file #{file}" unless File.readable? file case type when :html @html_tmpl = File.read file when :text @text_tmpl = File.read file else raise ArgumentError, "Invalid template type :#{type.to_s}" end end |