class Mail::ReceivedElement - mail-2.5.4 Documentation

# class Mail::ReceivedElement

### Public Class Methods

new( string ) click to toggle source

    # File lib/mail/elements/received_element.rb, line 6
    def initialize( string )
      parser = Mail::ReceivedParser.new
      if tree = parser.parse(string)
        @date_time = ::DateTime.parse("#{tree.date_time.date.text_value} #{tree.date_time.time.text_value}")
        @info = tree.name_val_list.text_value
      else
        raise Mail::Field::ParseError.new(ReceivedElement, string, parser.failure_reason)
      end
    end

### Public Instance Methods

date_time() click to toggle source

    # File lib/mail/elements/received_element.rb, line 16
    def date_time
      @date_time
    end

info() click to toggle source

    # File lib/mail/elements/received_element.rb, line 20
    def info
      @info
    end

to_s(*args) click to toggle source

    # File lib/mail/elements/received_element.rb, line 24
    def to_s(*args)
      "#{@info}; #{@date_time.to_s(*args)}"
    end