Sha256: 9d30567e209abc59ebdf537782652e249d713f85e9686ac6e7574407825cef21

Contents?: true

Size: 683 Bytes

Versions: 130

Compression:

Stored size: 683 Bytes

Contents

# encoding: utf-8
module Mail
  class ReceivedElement
    
    include Mail::Utilities
    
    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, "ReceivedElement can not parse |#{string}|\nReason was: #{parser.failure_reason}\n"
      end
    end
    
    def date_time
      @date_time
    end
    
    def info
      @info
    end
    
    def to_s(*args)
      "#{@info}; #{@date_time.to_s(*args)}"
    end
    
  end
end

Version data entries

130 entries across 100 versions & 6 rubygems

Version Path
mail-2.2.9.1 lib/mail/elements/received_element.rb
dball-mail-2.2.9.2 lib/mail/elements/received_element.rb
dball-mail-2.2.9.1 lib/mail/elements/received_element.rb
mail-2.2.9 lib/mail/elements/received_element.rb
mail-2.2.7 lib/mail/elements/received_element.rb
mail-2.2.6.1 lib/mail/elements/received_element.rb
mail-2.2.6 lib/mail/elements/received_element.rb
mail-2.2.5.2 lib/mail/elements/received_element.rb
mail-2.2.5.1 lib/mail/elements/received_element.rb
mail-2.2.5 lib/mail/elements/received_element.rb
mail-2.2.4 lib/mail/elements/received_element.rb
mail-2.2.3 lib/mail/elements/received_element.rb
mail-2.2.2 lib/mail/elements/received_element.rb
rack-mail_exception-0.0.1 vendor/mail/lib/mail/elements/received_element.rb
mail-2.2.1 lib/mail/elements/received_element.rb
mail-2.2.0 lib/mail/elements/received_element.rb
mail-2.1.5.3 lib/mail/elements/received_element.rb
mail-2.1.5.2 lib/mail/elements/received_element.rb
mail-2.1.5.1 lib/mail/elements/received_element.rb
mail-2.1.5 lib/mail/elements/received_element.rb