Method: Collective::Messager::Message#initialize

Defined in:
lib/collective/messager.rb

#initialize(data) ⇒ Message

Returns a new instance of Message.



94
95
96
97
98
99
100
101
102
# File 'lib/collective/messager.rb', line 94

def initialize( data )
  data         = ::Collective::Messager.symbolize(data)
  @to          = data[:to] or raise "must specify to address"
  @from        = data[:from] or raise "must specify from address"
  @at          = (data[:at] || Time.now).to_f
  @body        = data[:body]
  @id          = data[:id] || Digest::MD5.hexdigest([from,at,body].join)
  @reply_to_id = data[:reply_to_id]
end