Class: MessageFactory::Handlers::Nick
- Defined in:
- lib/messagefactory/handlers/NICK.rb
Instance Method Summary collapse
-
#process(string) ⇒ Object
- string
-
string to process Create a new Nick message OpenStruct will contain: #type #direction #raw #received #source #new_nick :nodoc: :[email protected] NICK :flock_of_deer.
- #types_process ⇒ Object
Instance Method Details
#process(string) ⇒ Object
- string
-
string to process
Create a new Nick message OpenStruct will contain: #type #direction #raw #received #source #new_nick :nodoc: :[email protected] NICK :flock_of_deer
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/messagefactory/handlers/NICK.rb', line 15 def process(string) string = string.dup m = mk_struct(string) begin m.type = :nick string.slice!(0) m.source = string.slice!(0, string.index(' ')) string.slice!(0) raise 'error' unless string.slice!(0, string.index(' ')).to_sym == :NICK string.slice!(0, string.index(' ')+2) m.new_nick = string rescue raise "Failed to parse Nick message: #{m.raw}" end m end |
#types_process ⇒ Object
7 8 9 |
# File 'lib/messagefactory/handlers/NICK.rb', line 7 def types_process :NICK end |