Class: Mail::MimeVersionField
Overview
Constant Summary
collapse
- NAME =
'MIME-Version'
Instance Attribute Summary
Attributes inherited from CommonField
#charset, #errors, #name, #value
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from CommonField
#default, #parse, parse, #responsible_for?, #singular?, #to_s
Constructor Details
#initialize(value = nil, charset = nil) ⇒ MimeVersionField
Returns a new instance of MimeVersionField.
13
14
15
16
|
# File 'lib/mail/fields/mime_version_field.rb', line 13
def initialize(value = nil, charset = nil)
value = '1.0' if Utilities.blank?(value)
super value, charset
end
|
Class Method Details
.singular? ⇒ Boolean
9
10
11
|
# File 'lib/mail/fields/mime_version_field.rb', line 9
def self.singular?
true
end
|
Instance Method Details
#decoded ⇒ Object
38
39
40
|
# File 'lib/mail/fields/mime_version_field.rb', line 38
def decoded
version
end
|
#element ⇒ Object
18
19
20
|
# File 'lib/mail/fields/mime_version_field.rb', line 18
def element
@element ||= Mail::MimeVersionElement.new(value)
end
|
#encoded ⇒ Object
34
35
36
|
# File 'lib/mail/fields/mime_version_field.rb', line 34
def encoded
"#{name}: #{version}\r\n"
end
|
#major ⇒ Object
26
27
28
|
# File 'lib/mail/fields/mime_version_field.rb', line 26
def major
element.major.to_i
end
|
#minor ⇒ Object
30
31
32
|
# File 'lib/mail/fields/mime_version_field.rb', line 30
def minor
element.minor.to_i
end
|
#version ⇒ Object
22
23
24
|
# File 'lib/mail/fields/mime_version_field.rb', line 22
def version
"#{element.major}.#{element.minor}"
end
|