Class: MessageFactory::Handlers::Created
- Defined in:
- lib/handlers/Created.rb
Instance Method Summary collapse
-
#process(string) ⇒ Object
- string
-
string to process Create a new Created message OpenStruct will contain: #type #direction #raw #server #received #created :nodoc: :not.configured 003 spox :This server was created Tue Mar 24 2009 at 15:42:36 PDT’.
-
#types_process ⇒ Object
Returns type(s) supported.
Instance Method Details
#process(string) ⇒ Object
- string
-
string to process
Create a new Created message OpenStruct will contain: #type #direction #raw #server #received #created :nodoc: :not.configured 003 spox :This server was created Tue Mar 24 2009 at 15:42:36 PDT’
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/handlers/Created.rb', line 17 def process(string) string = string.dup m = nil begin m = mk_struct(string) m.type = :created orig = string.dup string.downcase! string.slice!(0) m.server = string.slice!(0, string.index(' ')) string.slice!(0) raise 'Bad message type' unless string.slice!(0, string.index(' ')).to_sym == :'003' string.slice!(0, string.index('d')+2) time = Time.parse(string) m.created = time rescue raise "Failed to parse Created message: #{orig}" end m end |
#types_process ⇒ Object
Returns type(s) supported
8 9 10 |
# File 'lib/handlers/Created.rb', line 8 def types_process :'003' end |