class MayamlMutt::AccountInit

Public Instance Methods

render(mail_account, config = {}) click to toggle source
# File lib/mayaml-mutt/account_init.rb, line 24
def render(mail_account, config = {})
  ::Mustache.render(
    IO.read(template_file_path),
    name: mail_account.name,
    clean_name: clean_name(mail_account.name),
    accounts_dir: config.fetch(:accounts_dir, "~/.mutt/accounts")
  )
end

Private Instance Methods

clean_name(string) click to toggle source
# File lib/mayaml-mutt/account_init.rb, line 40
def clean_name(string)
  string.gsub(/\W/, "_")
end
template_file_path() click to toggle source
# File lib/mayaml-mutt/account_init.rb, line 35
def template_file_path
  templates_dir = File.expand_path("../templates", __dir__)
  File.join(templates_dir, "account_init.mustache")
end