Class: MessageFactory::Handlers::Quit
- Defined in:
- lib/messagefactory/handlers/QUIT.rb
Instance Method Summary collapse
-
#process(string) ⇒ Object
- string
-
string to process Create a new Quit message OpenStruct will contain: #type #direction #raw #received #source #message :nodoc: :spox!~spox@host QUIT :Ping timeout :spox!~spox@host QUIT :.
- #types_process ⇒ Object
Instance Method Details
#process(string) ⇒ Object
- string
-
string to process
Create a new Quit message OpenStruct will contain: #type #direction #raw #received #source #message :nodoc: :spox!~spox@host QUIT :Ping timeout
:spox!~spox@host QUIT :
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/messagefactory/handlers/QUIT.rb', line 16 def process(string) string = string.dup m = mk_struct(string) begin m.type = :quit string.slice!(0) m.source = string.slice!(0, string.index(' ')) string.slice!(0) idx = string.index(' ') idx ||= string.length raise unless string.slice!(0, idx).to_sym == :QUIT if(string.index(':')) string.slice!(0, string.index(':')+1) m. = string else m. = '' end rescue raise "Failed to parse Quit message: #{m.raw}" end m end |
#types_process ⇒ Object
7 8 9 |
# File 'lib/messagefactory/handlers/QUIT.rb', line 7 def types_process :QUIT end |