Class: Mail::CommonField
- Inherits:
-
Object
show all
- Defined in:
- lib/mail/fields/common_field.rb
Overview
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name = nil, value = nil, charset = nil) ⇒ CommonField
Returns a new instance of CommonField.
20
21
22
23
24
25
26
|
# File 'lib/mail/fields/common_field.rb', line 20
def initialize(name = nil, value = nil, charset = nil)
@errors = []
self.name = name
self.value = value
self.charset = charset || 'utf-8'
end
|
Instance Attribute Details
#charset ⇒ Object
Returns the value of attribute charset.
17
18
19
|
# File 'lib/mail/fields/common_field.rb', line 17
def charset
@charset
end
|
#errors ⇒ Object
Returns the value of attribute errors.
18
19
20
|
# File 'lib/mail/fields/common_field.rb', line 18
def errors
@errors
end
|
#name ⇒ Object
Returns the value of attribute name.
15
16
17
|
# File 'lib/mail/fields/common_field.rb', line 15
def name
@name
end
|
#value ⇒ Object
Returns the value of attribute value.
16
17
18
|
# File 'lib/mail/fields/common_field.rb', line 16
def value
@value
end
|
Class Method Details
.parse(*args) ⇒ Object
11
12
13
|
# File 'lib/mail/fields/common_field.rb', line 11
def self.parse(*args)
new(*args).tap(&:parse)
end
|
.singular? ⇒ Boolean
7
8
9
|
# File 'lib/mail/fields/common_field.rb', line 7
def self.singular?
false
end
|
Instance Method Details
#decoded ⇒ Object
54
55
56
|
# File 'lib/mail/fields/common_field.rb', line 54
def decoded
do_decode
end
|
#default ⇒ Object
50
51
52
|
# File 'lib/mail/fields/common_field.rb', line 50
def default
decoded
end
|
#element ⇒ Object
42
43
44
|
# File 'lib/mail/fields/common_field.rb', line 42
def element
nil
end
|
#encoded ⇒ Object
58
59
60
|
# File 'lib/mail/fields/common_field.rb', line 58
def encoded
do_encode
end
|
#parse ⇒ Object
38
39
40
|
# File 'lib/mail/fields/common_field.rb', line 38
def parse
tap(&:element)
end
|
#responsible_for?(field_name) ⇒ Boolean
62
63
64
|
# File 'lib/mail/fields/common_field.rb', line 62
def responsible_for?(field_name)
name.to_s.casecmp(field_name.to_s) == 0
end
|
#singular? ⇒ Boolean
28
29
30
|
# File 'lib/mail/fields/common_field.rb', line 28
def singular?
self.class.singular?
end
|
#to_s ⇒ Object
46
47
48
|
# File 'lib/mail/fields/common_field.rb', line 46
def to_s
decoded.to_s
end
|