Class: TMail::DeleteFields

Inherits:
Object
  • Object
show all
Defined in:
lib/action_mailer/vendor/tmail/net.rb

Constant Summary collapse

NOSEND_FIELDS =
%w(
  received
  bcc
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nosend = nil, delempty = true) ⇒ DeleteFields

Returns a new instance of DeleteFields.



156
157
158
159
# File 'lib/action_mailer/vendor/tmail/net.rb', line 156

def initialize( nosend = nil, delempty = true )
  @no_send_fields = nosend || NOSEND_FIELDS.dup
  @delete_empty_fields = delempty
end

Instance Attribute Details

#delete_empty_fieldsObject

Returns the value of attribute delete_empty_fields.



162
163
164
# File 'lib/action_mailer/vendor/tmail/net.rb', line 162

def delete_empty_fields
  @delete_empty_fields
end

#no_send_fieldsObject (readonly)

Returns the value of attribute no_send_fields.



161
162
163
# File 'lib/action_mailer/vendor/tmail/net.rb', line 161

def no_send_fields
  @no_send_fields
end

Instance Method Details

#exec(mail) ⇒ Object



164
165
166
167
168
169
# File 'lib/action_mailer/vendor/tmail/net.rb', line 164

def exec( mail )
  @no_send_fields.each do |nm|
    delete nm
  end
  delete_if {|n,v| v.empty? } if @delete_empty_fields
end