Class: ModSpox::Handlers::Ping
- Defined in:
- lib/mod_spox/handlers/Ping.rb
Instance Method Summary collapse
-
#initialize(handlers) ⇒ Ping
constructor
A new instance of Ping.
- #process(string) ⇒ Object
Methods inherited from Handler
Constructor Details
#initialize(handlers) ⇒ Ping
Returns a new instance of Ping.
5 6 7 |
# File 'lib/mod_spox/handlers/Ping.rb', line 5 def initialize(handlers) handlers[:PING] = self end |
Instance Method Details
#process(string) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/mod_spox/handlers/Ping.rb', line 8 def process(string) orig = string.dup string = string.dup begin string.slice!(0) if string[0] == ':' server = string[0..string.index(' ')-1] = string[string.index(':')+1..string.size] server = .dup if server == 'PING' return Messages::Incoming::Ping.new(orig, server, ) rescue Object => boom Logger.error("Failed to parse PING message: #{string}") raise boom end end |