Class: Fog::Parsers::XenServer::Base
- Inherits:
-
Object
- Object
- Fog::Parsers::XenServer::Base
- Defined in:
- lib/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.
7 8 9 |
# File 'lib/fog/xenserver/parser.rb', line 7 def initialize reset end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/fog/xenserver/parser.rb', line 5 def response @response end |
Instance Method Details
#parse(data) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fog/xenserver/parser.rb', line 15 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
11 12 13 |
# File 'lib/fog/xenserver/parser.rb', line 11 def reset @response = {} end |