class MayamlGetmail::AccountConfig
Public Instance Methods
render(mail_account, config = {})
click to toggle source
# File lib/mayaml-getmail/account_config.rb, line 24 def render(mail_account, config = {}) ::Mustache.render( IO.read(template_file_path), type: type(mail_account), server: mail_account.server, port: mail_account.port, user: mail_account.user, pass: mail_account.pass, mda_path: config.fetch(:mda_path, "/usr/bin/procmail"), read_all: config.fetch(:read_all, "true"), delete: config.fetch(:delete, "true"), mailboxes: mailboxes(mail_account) ) end
Private Instance Methods
mailboxes(mail_account)
click to toggle source
# File lib/mayaml-getmail/account_config.rb, line 56 def mailboxes(mail_account) "\"" + mail_account.mailboxes.join("\", \"") + "\"" unless mail_account.mailboxes.empty? end
template_file_path()
click to toggle source
# File lib/mayaml-getmail/account_config.rb, line 41 def template_file_path templates_dir = File.expand_path("../templates", __dir__) File.join(templates_dir, "account_config.mustache") end
type(mail_account)
click to toggle source
# File lib/mayaml-getmail/account_config.rb, line 46 def type(mail_account) types_map = { imap: "SimpleIMAPRetriever", imapssl: "SimpleIMAPSSLRetriever", pop3: "SimplePOP3Retriever", pop3ssl: "SimplePOP3SSLRetriever" } types_map.fetch mail_account.type end