Class: Gambit::Server::Message

Inherits:
Object
  • Object
show all
Includes:
Viewable
Defined in:
lib/gambit/server/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Viewable

append_features, #view

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

#bodyObject (readonly)

Returns the value of attribute body.



71
72
73
# File 'lib/gambit/server/message.rb', line 71

def body
  @body
end

#ccObject (readonly)

Returns the value of attribute cc.



71
72
73
# File 'lib/gambit/server/message.rb', line 71

def cc
  @cc
end

#fromObject (readonly)

Returns the value of attribute from.



71
72
73
# File 'lib/gambit/server/message.rb', line 71

def from
  @from
end

#subjectObject (readonly)

Returns the value of attribute subject.



71
72
73
# File 'lib/gambit/server/message.rb', line 71

def subject
  @subject
end

#timeObject (readonly)

Returns the value of attribute time.



71
72
73
# File 'lib/gambit/server/message.rb', line 71

def time
  @time
end

#toObject (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.send_message(@body,@from,@to)
	end
end