Sha256: fa04a999edc2ea17a39c81f6f695968ec74e567998dcdcd80fab97ec0c42c741

Contents?: true

Size: 674 Bytes

Versions: 121

Compression:

Stored size: 674 Bytes

Contents

# encoding: utf-8
module Mail
  class EnvelopeFromElement
    
    include Mail::Utilities
    
    def initialize( string )
      parser = Mail::EnvelopeFromParser.new
      if @tree = parser.parse(string)
        @address = tree.addr_spec.text_value.strip
        @date_time = ::DateTime.parse("#{tree.ctime_date.text_value}")
      else
        raise Mail::Field::ParseError.new(EnvelopeFromElement, string, parser.failure_reason)
      end
    end
    
    def tree
      @tree
    end
    
    def date_time
      @date_time
    end
    
    def address
      @address
    end
    
    def to_s(*args)
      "#{@info}; #{@date_time.to_s(*args)}"
    end
    
  end
end

Version data entries

121 entries across 109 versions & 12 rubygems

Version Path
mail-2.4.1 lib/mail/elements/envelope_from_element.rb