Sha256: 6019347a90bcde3785aec37694a6e8475a43ca481b53115bf8a03ed28e8a7c61

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 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 AccountsAlternates
    def render(account_names)
      return "" if account_names.nil? || account_names.empty?
      ::Mustache.render(
        IO.read(template_file_path),
        accounts: account_names.join(" ")
      )
    end

    private

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

Version data entries

2 entries across 2 versions & 1 rubygems

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