Module: Mail::CommonField

Includes:
Constants
Included in:
StructuredField, UnstructuredField
Defined in:
lib/mail/fields/common/common_field.rb

Overview

:nodoc:

Constant Summary

Constants included from Constants

Mail::Constants::ASTERISK, Mail::Constants::ATOM_UNSAFE, Mail::Constants::B_VALUES, Mail::Constants::CAPITAL_M, Mail::Constants::COLON, Mail::Constants::CONTROL_CHAR, Mail::Constants::CR, Mail::Constants::CRLF, Mail::Constants::CR_ENCODED, Mail::Constants::EMPTY, Mail::Constants::ENCODED_VALUE, Mail::Constants::EQUAL_LF, Mail::Constants::FIELD_BODY, Mail::Constants::FIELD_LINE, Mail::Constants::FIELD_NAME, Mail::Constants::FIELD_PREFIX, Mail::Constants::FIELD_SPLIT, Mail::Constants::FULL_ENCODED_VALUE, Mail::Constants::FWS, Mail::Constants::HEADER_LINE, Mail::Constants::HEADER_SPLIT, Mail::Constants::HYPHEN, Mail::Constants::LF, Mail::Constants::LF_ENCODED, Mail::Constants::NULL_SENDER, Mail::Constants::PHRASE_UNSAFE, Mail::Constants::QP_SAFE, Mail::Constants::QP_UNSAFE, Mail::Constants::Q_VALUES, Mail::Constants::SPACE, Mail::Constants::TEXT, Mail::Constants::TOKEN_UNSAFE, Mail::Constants::UNDERSCORE, Mail::Constants::WSP

Instance Method Summary collapse

Instance Method Details

#defaultObject



30
31
32
# File 'lib/mail/fields/common/common_field.rb', line 30

def default
  decoded
end

#field_lengthObject



34
35
36
# File 'lib/mail/fields/common/common_field.rb', line 34

def field_length
  @length ||= "#{name}: #{encode(decoded)}".length
end

#nameObject



11
12
13
# File 'lib/mail/fields/common/common_field.rb', line 11

def name
  @name ||= nil
end

#name=(value) ⇒ Object



7
8
9
# File 'lib/mail/fields/common/common_field.rb', line 7

def name=(value)
  @name = value
end

#responsible_for?(val) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/mail/fields/common/common_field.rb', line 38

def responsible_for?( val )
  name.to_s.casecmp(val.to_s) == 0
end

#to_sObject



26
27
28
# File 'lib/mail/fields/common/common_field.rb', line 26

def to_s
  decoded.to_s
end

#valueObject



22
23
24
# File 'lib/mail/fields/common/common_field.rb', line 22

def value
  @value
end

#value=(value) ⇒ Object



15
16
17
18
19
20
# File 'lib/mail/fields/common/common_field.rb', line 15

def value=(value)
  @length = nil
  @tree = nil
  @element = nil
  @value = value
end