Sha256: 680b933c146e5ce39967c5bf34c026d0320339fa6607763fa6d62ea811c6b366

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

# Copyright (C) 2016, 2017 Szymon Kopciewski
#
# This file is part of MayamlMutt.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

require "mustache"

module MayamlMutt
  class AccountCreds
    def render(mail_account)
      ::Mustache.render(
        IO.read(template_file_path),
        name: mail_account.name,
        realname: mail_account.realname,
        user: mail_account.user,
        pass: mail_account.pass,
        server: mail_account.server,
        smtp_protocol: mail_account.smtp_protocol,
        smtp_port: mail_account.smtp_port,
        smtp_authenticator: mail_account.smtp_authenticator,
        smtp_server: mail_account.smtp_server
      )
    end

    private

    def template_file_path
      File.join(Gem.datadir("mayaml-mutt"), "account_creds.mustache")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mayaml-mutt-4.0.1 lib/mayaml-mutt/account_creds.rb
mayaml-mutt-4.0.0 lib/mayaml-mutt/account_creds.rb