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.



175
176
177
178
# File 'lib/action_mailer/vendor/tmail/net.rb', line 175

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.



181
182
183
# File 'lib/action_mailer/vendor/tmail/net.rb', line 181

def delete_empty_fields
  @delete_empty_fields
end

#no_send_fieldsObject (readonly)

Returns the value of attribute no_send_fields.



180
181
182
# File 'lib/action_mailer/vendor/tmail/net.rb', line 180

def no_send_fields
  @no_send_fields
end

Instance Method Details

#exec(mail) ⇒ Object



183
184
185
186
187
188
# File 'lib/action_mailer/vendor/tmail/net.rb', line 183

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