Class: MessageFactory::Handlers::LuserChannels

Inherits:
Handler
  • Object
show all
Defined in:
lib/messagefactory/handlers/254.rb

Instance Method Summary collapse

Instance Method Details

#process(string) ⇒ Object

string

string to process

Create a new LuserChannels message OpenStruct will contain: #type #direction #raw #received #server #target #num_channels #message :nodoc: :crichton.freenode.net 254 spox 24466 :channels formed



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/messagefactory/handlers/254.rb', line 13

def process(string)
    string = string.dup
    orig = string.dup
    m = nil
    begin
        m = mk_struct(string)
        m.type = :luserchannels
        string.slice!(0)
        m.server = string.slice!(0, string.index(' '))
        string.slice!(' ')
        raise 'error' unless string.slice!(0, string.index(' ')).to_sym == :'254'
        string.slice!(0)
        m.target = string.slice!(0, string.index(' '))
        string.slice!(0)
        m.num_channels = string.slice!(0, string.index(' '))
        string.slice!(0, string.index(':')+1)
        m.message = string
    rescue
        raise "Failed to parse LuserChannels message: #{orig}"
    end
    m
end

#types_processObject



5
6
7
# File 'lib/messagefactory/handlers/254.rb', line 5

def types_process
    :'254'
end