Class: Fog::Parsers::XenServer::Base
- Inherits:
-
Object
- Object
- Fog::Parsers::XenServer::Base
- Defined in:
- lib/rackspace-fog/xenserver/parser.rb
Direct Known Subclasses
GetHosts, GetNetworks, GetPools, GetRecords, GetStorageRepositories, GetVBDs, GetVIFs, GetVms
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #parse(data) ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
8 9 10 |
# File 'lib/rackspace-fog/xenserver/parser.rb', line 8 def initialize reset end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/rackspace-fog/xenserver/parser.rb', line 6 def response @response end |
Instance Method Details
#parse(data) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rackspace-fog/xenserver/parser.rb', line 16 def parse( data ) if data.kind_of? Hash @response = data.symbolize_keys! @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 ⇒ Object
12 13 14 |
# File 'lib/rackspace-fog/xenserver/parser.rb', line 12 def reset @response = {} end |