Class: MessageFactory::Handlers::Kick
- Defined in:
- lib/messagefactory/handlers/KICK.rb
Instance Method Summary collapse
-
#process(string) ⇒ Object
- string
-
string to process Create a new Kick message OpenStruct will contain: #type #direction #raw #received #source #target #channel #message :nodoc: :spax!~spox@host KICK #m spox :foo.
- #types_process ⇒ Object
Instance Method Details
#process(string) ⇒ Object
- string
-
string to process
Create a new Kick message OpenStruct will contain: #type #direction #raw #received #source #target #channel #message :nodoc: :spax!~spox@host KICK #m spox :foo
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/messagefactory/handlers/KICK.rb', line 12 def process(string) string = string.dup orig = string.dup m = nil begin m = mk_struct(string) m.type = :kick string.slice!(0) m.source = string.slice!(0, string.index(' ')) string.slice!(0) raise 'error' unless string.slice!(0, string.index(' ')).to_sym == :KICK string.slice!(0) m.channel = string.slice!(0, string.index(' ')) string.slice!(0) m.target = string.slice!(0, string.index(' ')) string.slice!(0, 2) m. = string rescue raise "Failed to parse Kick message: #{orig}" end m end |
#types_process ⇒ Object
4 5 6 |
# File 'lib/messagefactory/handlers/KICK.rb', line 4 def types_process :KICK end |