Sha256: 8be599cc1ccc486277f136339f7c2a4f43c2ed7aff75462cd40495e924500cbb
Contents?: true
Size: 876 Bytes
Versions: 1
Compression:
Stored size: 876 Bytes
Contents
require 'mail' require_relative 'accessors' module MailXSMTPAPI class Field < ::Mail::UnstructuredField FIELD_NAME = 'x-smtpapi' CAPITALIZED_FIELD = 'X-SMTPAPI' # Accessors include Recipients include Substitutions include UniqueArguments include Category include Filters def initialize(value = nil, charset = 'utf-8') self.charset = charset self.name = CAPITALIZED_FIELD self.value = value || {} end def encoded if empty? '' else "#{wrapped_value}\r\n" end end # to take advantage of folding, decoded must return a string with # emits JSON with extra spaces inserted for line wrapping. def decoded JSON.generate(value).gsub(/(["\]}])([,:])(["\[{])/, '\\1\\2 \\3') end def empty? value.values.all?{|v| !v || v.empty? } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mail-x_smtpapi-1.0.0.alpha2 | lib/mail_x_smtpapi/field.rb |