Class: Gambit::Server::Message
- Inherits:
-
Object
- Object
- Gambit::Server::Message
- Includes:
- Viewable
- Defined in:
- lib/gambit/server/message.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#cc ⇒ Object
readonly
Returns the value of attribute cc.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(from, to, subject, body) ⇒ Message
constructor
A new instance of Message.
- #send(other_player) ⇒ Object
- #smtp_send(smtp_host) ⇒ Object
Methods included from Viewable
Constructor Details
#initialize(from, to, subject, body) ⇒ Message
Returns a new instance of Message.
62 63 64 65 66 67 68 69 |
# File 'lib/gambit/server/message.rb', line 62 def initialize(from,to,subject,body) @from = from @to = to @subject = subject @body = body @time = Time.now @cc = Array.new end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
71 72 73 |
# File 'lib/gambit/server/message.rb', line 71 def body @body end |
#cc ⇒ Object (readonly)
Returns the value of attribute cc.
71 72 73 |
# File 'lib/gambit/server/message.rb', line 71 def cc @cc end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
71 72 73 |
# File 'lib/gambit/server/message.rb', line 71 def from @from end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
71 72 73 |
# File 'lib/gambit/server/message.rb', line 71 def subject @subject end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
71 72 73 |
# File 'lib/gambit/server/message.rb', line 71 def time @time end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
71 72 73 |
# File 'lib/gambit/server/message.rb', line 71 def to @to end |
Instance Method Details
#send(other_player) ⇒ Object
79 80 81 82 |
# File 'lib/gambit/server/message.rb', line 79 def send(other_player) #lookup player in server #player.add_message(self) end |
#smtp_send(smtp_host) ⇒ Object
73 74 75 76 77 |
# File 'lib/gambit/server/message.rb', line 73 def smtp_send(smtp_host) Net::SMTP.start(smtp_host) do |smtp| smtp.(@body,@from,@to) end end |