Module: ImapArchiver::Config
- Included in:
- Archiver
- Defined in:
- lib/imap_archiver/config.rb
Instance Attribute Summary collapse
-
#archive_folder ⇒ Object
Returns the value of attribute archive_folder.
-
#archive_folder_acl ⇒ Object
Returns the value of attribute archive_folder_acl.
-
#auth_mech ⇒ Object
Returns the value of attribute auth_mech.
-
#base_folder ⇒ Object
Returns the value of attribute base_folder.
-
#folders_to_archive ⇒ Object
Returns the value of attribute folders_to_archive.
-
#imap_server ⇒ Object
Returns the value of attribute imap_server.
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
- .included(base) ⇒ Object
-
.load_config(config_file) ⇒ Object
@@config_struct = ::OpenStruct.new(=> ”, :username => ”, :password => ”).
-
.method_missing(method, *args) ⇒ Object
private.
- .run {|_self| ... } ⇒ Object
Instance Method Summary collapse
-
#config_valid? ⇒ Boolean
def method_missing(method, *args) @@config_struct.send(method,*args) end.
- #load_config(config_file) ⇒ Object
Instance Attribute Details
#archive_folder ⇒ Object
Returns the value of attribute archive_folder.
4 5 6 |
# File 'lib/imap_archiver/config.rb', line 4 def archive_folder @archive_folder end |
#archive_folder_acl ⇒ Object
Returns the value of attribute archive_folder_acl.
4 5 6 |
# File 'lib/imap_archiver/config.rb', line 4 def archive_folder_acl @archive_folder_acl end |
#auth_mech ⇒ Object
Returns the value of attribute auth_mech.
4 5 6 |
# File 'lib/imap_archiver/config.rb', line 4 def auth_mech @auth_mech end |
#base_folder ⇒ Object
Returns the value of attribute base_folder.
4 5 6 |
# File 'lib/imap_archiver/config.rb', line 4 def base_folder @base_folder end |
#folders_to_archive ⇒ Object
Returns the value of attribute folders_to_archive.
4 5 6 |
# File 'lib/imap_archiver/config.rb', line 4 def folders_to_archive @folders_to_archive end |
#imap_server ⇒ Object
Returns the value of attribute imap_server.
4 5 6 |
# File 'lib/imap_archiver/config.rb', line 4 def imap_server @imap_server end |
#password ⇒ Object
Returns the value of attribute password.
4 5 6 |
# File 'lib/imap_archiver/config.rb', line 4 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
4 5 6 |
# File 'lib/imap_archiver/config.rb', line 4 def username @username end |
Class Method Details
.included(base) ⇒ Object
27 28 29 |
# File 'lib/imap_archiver/config.rb', line 27 def self.included(base) base.extend(self) end |
.load_config(config_file) ⇒ Object
@@config_struct = ::OpenStruct.new(=> ”,
:username => '',
:password => '')
10 11 12 13 14 15 16 |
# File 'lib/imap_archiver/config.rb', line 10 def self.load_config(config_file) begin load config_file rescue LoadError => e raise "Config_file not found! #{config_file} #{e}" end end |
.method_missing(method, *args) ⇒ Object
private
42 43 44 |
# File 'lib/imap_archiver/config.rb', line 42 def self.method_missing(method, *args) @@base.send(method,*args) end |
.run {|_self| ... } ⇒ Object
23 24 25 |
# File 'lib/imap_archiver/config.rb', line 23 def self.run yield self end |
Instance Method Details
#config_valid? ⇒ Boolean
def method_missing(method, *args)
@@config_struct.send(method,*args)
end
35 36 37 38 39 40 |
# File 'lib/imap_archiver/config.rb', line 35 def config_valid? self.auth_mech ||= "CRAM-MD5" raise "No imap server in configuration file!" if self.imap_server.nil? raise "No username in configuration file!" if username.nil? raise "No password in configuration file!" if password.nil? end |
#load_config(config_file) ⇒ Object
18 19 20 21 |
# File 'lib/imap_archiver/config.rb', line 18 def load_config(config_file) @@base = self ImapArchiver::Config.load_config(config_file) end |