Class: MailParser::RFC2822::Mailbox
- Inherits:
-
Object
- Object
- MailParser::RFC2822::Mailbox
- Defined in:
- lib/mailparser/rfc2822.rb
Instance Attribute Summary collapse
-
#addr_spec ⇒ Object
readonly
Returns the value of attribute addr_spec.
-
#comments ⇒ Object
Returns the value of attribute comments.
-
#display_name ⇒ Object
(also: #phrase)
readonly
Returns the value of attribute display_name.
Instance Method Summary collapse
- #domain ⇒ Object
-
#initialize(addr_spec, display_name = nil) ⇒ Mailbox
constructor
A new instance of Mailbox.
- #local_part ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(addr_spec, display_name = nil) ⇒ Mailbox
Returns a new instance of Mailbox.
85 86 87 88 89 |
# File 'lib/mailparser/rfc2822.rb', line 85 def initialize(addr_spec, display_name=nil) @addr_spec = addr_spec @display_name = display_name || "" @comments = [] end |
Instance Attribute Details
#addr_spec ⇒ Object (readonly)
Returns the value of attribute addr_spec.
90 91 92 |
# File 'lib/mailparser/rfc2822.rb', line 90 def addr_spec @addr_spec end |
#comments ⇒ Object
Returns the value of attribute comments.
91 92 93 |
# File 'lib/mailparser/rfc2822.rb', line 91 def comments @comments end |
#display_name ⇒ Object (readonly) Also known as: phrase
Returns the value of attribute display_name.
90 91 92 |
# File 'lib/mailparser/rfc2822.rb', line 90 def display_name @display_name end |
Instance Method Details
#domain ⇒ Object
96 97 98 |
# File 'lib/mailparser/rfc2822.rb', line 96 def domain() @addr_spec.domain end |
#local_part ⇒ Object
93 94 95 |
# File 'lib/mailparser/rfc2822.rb', line 93 def local_part() @addr_spec.local_part end |
#to_s ⇒ Object
99 100 101 102 103 104 105 |
# File 'lib/mailparser/rfc2822.rb', line 99 def to_s() if display_name.empty? then "<#{@addr_spec}>" else "#{@display_name} <#{@addr_spec}>" end end |