class Mail::MimeVersionField - mail-2.5.4 Documentation

# class Mail::MimeVersionField

### Constants

CAPITALIZED_FIELD
FIELD_NAME

### Public Class Methods

new(value = nil, charset = 'utf-8') click to toggle source
Calls superclass method

    # File lib/mail/fields/mime_version_field.rb, line 10
    def initialize(value = nil, charset = 'utf-8')
      self.charset = charset
      if value.blank?
        value = '1.0'
      end
      super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
      self.parse
      self

    end

### Public Instance Methods

decoded() click to toggle source

    # File lib/mail/fields/mime_version_field.rb, line 47
    def decoded
      version
    end

element() click to toggle source

    # File lib/mail/fields/mime_version_field.rb, line 27
    def element
      @element ||= Mail::MimeVersionElement.new(value)
    end

encoded() click to toggle source

    # File lib/mail/fields/mime_version_field.rb, line 43
    def encoded
      "#{CAPITALIZED_FIELD}: #{version}\r\n"
    end

major() click to toggle source

    # File lib/mail/fields/mime_version_field.rb, line 35
    def major
      element.major.to_i
    end

minor() click to toggle source

    # File lib/mail/fields/mime_version_field.rb, line 39
    def minor
      element.minor.to_i
    end

parse(val = value) click to toggle source

    # File lib/mail/fields/mime_version_field.rb, line 21
    def parse(val = value)
      unless val.blank?
        @element = Mail::MimeVersionElement.new(val)
      end
    end

version() click to toggle source

    # File lib/mail/fields/mime_version_field.rb, line 31
    def version
      "#{element.major}.#{element.minor}"
    end