Class: Msg::Recipient
- Inherits:
-
Object
- Object
- Msg::Recipient
- Defined in:
- lib/msg.rb
Overview
Recipient serves as a container for the recip directories in the .msg. It has things like office_location, business_telephone_number, but I don’t think enough to make a vCard out of?
Constant Summary collapse
- RECIPIENT_TYPES =
{ 0 => :orig, 1 => :to, 2 => :cc, 3 => :bcc }
Instance Attribute Summary collapse
-
#obj ⇒ Object
readonly
Returns the value of attribute obj.
-
#properties ⇒ Object
(also: #props)
readonly
Returns the value of attribute properties.
Instance Method Summary collapse
- #email ⇒ Object
-
#initialize(obj) ⇒ Recipient
constructor
A new instance of Recipient.
- #inspect ⇒ Object
-
#name ⇒ Object
some kind of best effort guess for converting to standard mime style format.
- #to_s ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(obj) ⇒ Recipient
467 468 469 470 471 472 473 |
# File 'lib/msg.rb', line 467 def initialize obj @obj = obj @properties = Properties.load @obj @properties.unused.each do |child| # FIXME warn end end |
Instance Attribute Details
#obj ⇒ Object (readonly)
Returns the value of attribute obj.
464 465 466 |
# File 'lib/msg.rb', line 464 def obj @obj end |
#properties ⇒ Object (readonly) Also known as: props
Returns the value of attribute properties.
464 465 466 |
# File 'lib/msg.rb', line 464 def properties @properties end |
Instance Method Details
#email ⇒ Object
487 488 489 |
# File 'lib/msg.rb', line 487 def email props.smtp_address || props.org_email_addr || props.email_address end |
#inspect ⇒ Object
504 505 506 |
# File 'lib/msg.rb', line 504 def inspect "#<#{self.class.to_s[/\w+$/]}:#{self.to_s.inspect}>" end |
#name ⇒ Object
some kind of best effort guess for converting to standard mime style format. there are some rules for encoding non 7bit stuff in mail headers. should obey that here, as these strings could be unicode email_address will be an EX:/ address (X.400?), unless external recipient. the other two we try first. consider using entry id for this too.
481 482 483 484 485 |
# File 'lib/msg.rb', line 481 def name name = props.transmittable_display_name || props.display_name # dequote name[/^'(.*)'/, 1] or name rescue nil end |
#to_s ⇒ Object
496 497 498 499 500 501 502 |
# File 'lib/msg.rb', line 496 def to_s if name = self.name and !name.empty? and email && name != email %{"#{name}" <#{email}>} else email || name end end |
#type ⇒ Object
492 493 494 |
# File 'lib/msg.rb', line 492 def type RECIPIENT_TYPES[props.recipient_type] end |