Class: MessageFactory::Handlers::Welcome
- Defined in:
- lib/messagefactory/handlers/001.rb
Instance Method Summary collapse
-
#process(string) ⇒ Object
- string
-
string to process Create a new Welcome message OpenStruct will contain: #type #direction #raw #received #message #target #user #server :nodoc: :not.configured 001 spox :Welcome to the unconfigured IRC Network [email protected].
- #types_process ⇒ Object
Instance Method Details
#process(string) ⇒ Object
- string
-
string to process
Create a new Welcome message OpenStruct will contain: #type #direction #raw #received #message #target #user #server :nodoc: :not.configured 001 spox :Welcome to the unconfigured IRC Network [email protected]
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/001.rb', line 13 def process(string) string = string.dup orig = string.dup m = nil begin m = mk_struct(string) m.type = :welcome string.slice!(0) m.server = string.slice!(0, string.index(' ')) string.slice!(0) raise 'error' unless string.slice!(0, string.index(' ')).to_sym == :'001' string.slice!(0) m.target = string.slice!(0, string.index(' ')) string.slice!(0, string.index(':')+1) m. = string.slice!(0, string.rindex(' ')) string.slice!(0) m.user = string rescue raise "Failed to parse Welcome message: #{orig}" end m end |
#types_process ⇒ Object
5 6 7 |
# File 'lib/messagefactory/handlers/001.rb', line 5 def types_process :'001' end |