Method: Zircon::Message#initialize

Defined in:
lib/zircon/message.rb

#initialize(text) ⇒ Message

Returns a new instance of Message.



7
8
9
10
11
12
13
14
15
16
# File 'lib/zircon/message.rb', line 7

def initialize(text)
  if match = Patterns::MESSAGE_PATTERN.match(text)
    @text    = text
    @prefix  = match[1]
    @command = match[2]
    @rest    = match[3..-1]
  else
    raise ArgumentError.new("Invalid message: #{text}")
  end
end