Class: TMail::Attachment

Inherits:
StringIO
  • Object
show all
Includes:
TextUtils
Defined in:
lib/tmail/quoting.rb,
lib/tmail/attachments.rb

Constant Summary

Constants included from TextUtils

TextUtils::ATOM_UNSAFE, TextUtils::CONTROL_CHAR, TextUtils::MESSAGE_ID, TextUtils::MIME_ENCODED, TextUtils::MONTH, TextUtils::NKF_FLAGS, TextUtils::PHRASE_UNSAFE, TextUtils::RFC2231_ENCODED, TextUtils::TOKEN_UNSAFE, TextUtils::WDAY, TextUtils::ZONESTR_TABLE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TextUtils

#atom_safe?, #decode_RFC2231, #decode_params, #join_domain, #message_id?, #mime_encoded?, #quote_atom, #quote_boundary, #quote_phrase, #quote_token, #quote_unquoted_bencode, #quote_unquoted_name, #time2str, #timezone_string_to_unixtime, #to_kcode, #token_safe?, #unquote

Instance Attribute Details

#content_typeObject

Returns the value of attribute content_type.



12
13
14
# File 'lib/tmail/attachments.rb', line 12

def content_type
  @content_type
end

#original_filename(to_charset = 'utf-8') ⇒ Object Also known as: quoted_filename

Only unquote if quoted



68
69
70
71
72
73
74
# File 'lib/tmail/quoting.rb', line 68

def original_filename(to_charset = 'utf-8')
  if quoted?(quoted_filename)
    Unquoter.unquote_and_convert_to(quoted_filename, to_charset).chomp
  else
    quoted_filename
  end
end

Instance Method Details

#quoted?(string) ⇒ Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/tmail/quoting.rb', line 63

def quoted?(string)
  !!((string =~ /.+'\w\w'.+/) || (string =~ /=\?.+\?.\?.+\?=/))
end