Class: Mail::EnvelopeFromElement
- Includes:
- Utilities
- Defined in:
- lib/mail/elements/envelope_from_element.rb
Constant Summary
Constants included from Patterns
Patterns::ATOM_UNSAFE, Patterns::CONTROL_CHAR, Patterns::CRLF, Patterns::FIELD_BODY, Patterns::FIELD_LINE, Patterns::FIELD_NAME, Patterns::FIELD_PREFIX, Patterns::FIELD_SPLIT, Patterns::FWS, Patterns::HEADER_LINE, Patterns::HEADER_SPLIT, Patterns::PHRASE_UNSAFE, Patterns::QP_SAFE, Patterns::QP_UNSAFE, Patterns::TEXT, Patterns::TOKEN_UNSAFE, Patterns::WSP
Instance Method Summary collapse
- #address ⇒ Object
- #date_time ⇒ Object
-
#formatted_date_time ⇒ Object
RFC 4155: a timestamp indicating the UTC date and time when the message was originally received, conformant with the syntax of the traditional UNIX ‘ctime’ output sans timezone (note that the use of UTC precludes the need for a timezone indicator);.
-
#initialize(string) ⇒ EnvelopeFromElement
constructor
A new instance of EnvelopeFromElement.
- #to_s ⇒ Object
Methods included from Utilities
#atom_safe?, #bracket, #capitalize_field, #constantize, #dasherize, #dquote, #escape_paren, #map_lines, #map_with_index, #match_to_s, #paren, #quote_atom, #quote_phrase, #quote_token, #token_safe?, #unbracket, #underscoreize, #unparen, #unquote, #uri_escape, #uri_parser, #uri_unescape
Constructor Details
#initialize(string) ⇒ EnvelopeFromElement
Returns a new instance of EnvelopeFromElement.
7 8 9 10 11 |
# File 'lib/mail/elements/envelope_from_element.rb', line 7 def initialize( string ) @envelope_from = Mail::Parsers::EnvelopeFromParser.new.parse(string) @address = @envelope_from.address @date_time = ::DateTime.parse(@envelope_from.ctime_date) end |
Instance Method Details
#address ⇒ Object
17 18 19 |
# File 'lib/mail/elements/envelope_from_element.rb', line 17 def address @address end |
#date_time ⇒ Object
13 14 15 |
# File 'lib/mail/elements/envelope_from_element.rb', line 13 def date_time @date_time end |
#formatted_date_time ⇒ Object
RFC 4155:
a indicating the UTC date and time when the
was originally received, conformant with the syntax of the
traditional UNIX 'ctime' output sans timezone (note that the
use of UTC precludes the need for a timezone indicator);
26 27 28 29 30 31 32 |
# File 'lib/mail/elements/envelope_from_element.rb', line 26 def formatted_date_time if @date_time.respond_to?(:ctime) @date_time.ctime else @date_time.strftime '%a %b %e %T %Y' end end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/mail/elements/envelope_from_element.rb', line 34 def to_s "#{@address} #{formatted_date_time}" end |