Class: Flamethrower::Irc::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/flamethrower/irc/message.rb

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ Message

Returns a new instance of Message.



4
5
6
# File 'lib/flamethrower/irc/message.rb', line 4

def initialize(message)
  @message = message
end

Instance Method Details

#commandObject



14
15
16
# File 'lib/flamethrower/irc/message.rb', line 14

def command
  parse[:command]
end

#parametersObject



18
19
20
# File 'lib/flamethrower/irc/message.rb', line 18

def parameters
  parse[:params]
end

#parseObject



8
9
10
11
12
# File 'lib/flamethrower/irc/message.rb', line 8

def parse
  terms = @message.split("\s")
  params = terms - [terms.first]
  {:command => terms.first, :params => strip_prefixes(params)}
end

#to_sObject



22
23
24
# File 'lib/flamethrower/irc/message.rb', line 22

def to_s
  @message
end