Class: TMail::DeleteFields

Inherits:
Object show all
Defined in:
lib/gems/tmail-1.2.3.1/lib/tmail/net.rb

Overview

:stopdoc:

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.



138
139
140
141
# File 'lib/gems/tmail-1.2.3.1/lib/tmail/net.rb', line 138

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.



144
145
146
# File 'lib/gems/tmail-1.2.3.1/lib/tmail/net.rb', line 144

def delete_empty_fields
  @delete_empty_fields
end

#no_send_fieldsObject (readonly)

Returns the value of attribute no_send_fields.



143
144
145
# File 'lib/gems/tmail-1.2.3.1/lib/tmail/net.rb', line 143

def no_send_fields
  @no_send_fields
end

Instance Method Details

#exec(mail) ⇒ Object



146
147
148
149
150
151
# File 'lib/gems/tmail-1.2.3.1/lib/tmail/net.rb', line 146

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