Class: ModSpox::Handlers::Created

Inherits:
Handler
  • Object
show all
Defined in:
lib/mod_spox/handlers/Created.rb

Instance Method Summary collapse

Methods inherited from Handler

#preprocess

Constructor Details

#initialize(handlers) ⇒ Created

Returns a new instance of Created.



6
7
8
# File 'lib/mod_spox/handlers/Created.rb', line 6

def initialize(handlers)
    handlers[RPL_CREATED] = self
end

Instance Method Details

#process(string) ⇒ Object

:not.configured 003 spox :This server was created Tue Mar 24 2009 at 15:42:36 PDT’



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/mod_spox/handlers/Created.rb', line 10

def process(string)
    string = string.dup
    begin
        orig = string.dup
        2.times{string.slice!(0..string.index(':'))}
        4.times{string.slice!(0..string.index(' '))}
        time = Time.parse(string)
        time = nil if Time.now == time
        return time.nil? ? nil : Messages::Incoming::Created.new(orig, time)
    rescue Object => boom
        Logger.error("Failed to parse RPL_CREATED message: #{orig}")
        raise boom
    end
end