Class: Asterisk::Mailcmd::Settings

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/asterisk/mailcmd/settings.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.html_tmplObject

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_tmplObject

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

Raises:

  • (ArgumentError)


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