Class: Mail::MimeVersionField
- Inherits:
-
StructuredField
- Object
- StructuredField
- Mail::MimeVersionField
- Defined in:
- lib/mail/fields/mime_version_field.rb
Constant Summary collapse
- FIELD_NAME =
'mime-version'
- CAPITALIZED_FIELD =
'Mime-Version'
Instance Method Summary collapse
- #decoded ⇒ Object
- #element ⇒ Object
- #encoded ⇒ Object
-
#initialize(*args) ⇒ MimeVersionField
constructor
A new instance of MimeVersionField.
- #major ⇒ Object
- #minor ⇒ Object
- #parse(val = value) ⇒ Object
- #version ⇒ Object
Methods inherited from StructuredField
Methods included from Utilities
Methods included from CommonField
Constructor Details
#initialize(*args) ⇒ MimeVersionField
Returns a new instance of MimeVersionField.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/mail/fields/mime_version_field.rb', line 11 def initialize(*args) if args.last.blank? self.name = CAPITALIZED_FIELD self.value = '1.0' else super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last)) end self.parse self end |
Instance Method Details
#decoded ⇒ Object
49 50 51 |
# File 'lib/mail/fields/mime_version_field.rb', line 49 def decoded value end |
#element ⇒ Object
29 30 31 |
# File 'lib/mail/fields/mime_version_field.rb', line 29 def element @element ||= Mail::MimeVersionElement.new(value) end |
#encoded ⇒ Object
45 46 47 |
# File 'lib/mail/fields/mime_version_field.rb', line 45 def encoded "#{CAPITALIZED_FIELD}: #{value}\r\n" end |
#major ⇒ Object
37 38 39 |
# File 'lib/mail/fields/mime_version_field.rb', line 37 def major element.major.to_i end |
#minor ⇒ Object
41 42 43 |
# File 'lib/mail/fields/mime_version_field.rb', line 41 def minor element.minor.to_i end |
#parse(val = value) ⇒ Object
23 24 25 26 27 |
# File 'lib/mail/fields/mime_version_field.rb', line 23 def parse(val = value) unless val.blank? @element = Mail::MimeVersionElement.new(val) end end |
#version ⇒ Object
33 34 35 |
# File 'lib/mail/fields/mime_version_field.rb', line 33 def version "#{element.major}.#{element.minor}" end |