Class: Fog::Compute::Ovirt::ExceptionWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/ovirt/compute.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ExceptionWrapper

Returns a new instance of ExceptionWrapper.



30
31
32
# File 'lib/fog/ovirt/compute.rb', line 30

def initialize(client)
  @client = client
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/fog/ovirt/compute.rb', line 34

def method_missing(symbol, *args)
  super unless @client.respond_to?(symbol)

  if block_given?
    @client.__send__(symbol, *args) do |*block_args|
      yield(*block_args)
    end
  else
    @client.__send__(symbol, *args)
  end
rescue StandardError => e
  raise ::Fog::Ovirt::Errors::OvirtEngineError, e
end

Instance Method Details

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/fog/ovirt/compute.rb', line 48

def respond_to_missing?(method_name, include_private = false)
  @client.respond_to?(symbol, include_all) || super
end