Module: Mail::CommonField

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

Overview

:nodoc:

Constant Summary

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::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



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

def default
  decoded
end

#field_lengthObject



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

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

#nameObject



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

def name
  @name ||= nil
end

#name=(value) ⇒ Object



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

def name=(value)
  @name = value
end

#responsible_for?(val) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#to_sObject



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

def to_s
  decoded.to_s
end

#valueObject



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

def value
  @value
end

#value=(value) ⇒ Object



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

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