Sha256: e7cbd9d1962b26d488cc4f2ac37616086da9ac0fcedfbb456777eb614a211412

Contents?: true

Size: 703 Bytes

Versions: 4

Compression:

Stored size: 703 Bytes

Contents

module Fog
  module Parsers
    module XenServer
      class Base

        attr_reader :response

        def initialize
          reset
        end

        def reset
          @response = {}
        end

        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

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
fog-xenserver-0.0.1.alpha2 lib/fog/xenserver/parser.rb
fog-xenserver-0.0.1.alpha lib/fog/xenserver/parser.rb
fog-1.22.0 lib/fog/xenserver/parser.rb
fog-1.21.0 lib/fog/xenserver/parser.rb