Class: TMail::DeleteFields

Inherits:
Object show all
Defined in:
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.


140
141
142
143
# File 'lib/tmail/net.rb', line 140

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


146
147
148
# File 'lib/tmail/net.rb', line 146

def delete_empty_fields
  @delete_empty_fields
end

#no_send_fieldsObject (readonly)

Returns the value of attribute no_send_fields


145
146
147
# File 'lib/tmail/net.rb', line 145

def no_send_fields
  @no_send_fields
end

Instance Method Details

#exec(mail) ⇒ Object


148
149
150
151
152
153
# File 'lib/tmail/net.rb', line 148

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