class Fog::XenServer::Parsers::Base
Attributes
response[R]
Public Class Methods
new()
click to toggle source
# File lib/fog/xenserver/parsers/base.rb, line 7 def initialize reset end
Public Instance Methods
parse( data )
click to toggle source
# File lib/fog/xenserver/parsers/base.rb, line 15 def parse( data ) if data.kind_of? Hash data.keys.each do |key| data[key.to_sym] = data.delete(key) if key.respond_to?(:to_sym) end @response = data @response.each do |k,v| if @response[k] == "OpaqueRef:NULL" @response[k] = nil end end elsif data.kind_of? Array @response = data.first elsif data.kind_of?(String) and data =~ /OpaqueRef:/ @response = data end @response end
reset()
click to toggle source
# File lib/fog/xenserver/parsers/base.rb, line 11 def reset @response = {} end