Module: TestLab::Node::MethodMissing

Included in:
TestLab::Node
Defined in:
lib/testlab/node/method_missing.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *method_args) ⇒ Object

Node Method Missing Handler



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/testlab/node/method_missing.rb', line 7

def method_missing(method_name, *method_args)
  @ui.logger.debug { "NODE METHOD MISSING: #{method_name.inspect}(#{method_args.inspect})" }

  if TestLab::Provider::PROXY_METHODS.include?(method_name)
    result = nil

    if @provider.respond_to?(method_name)
      @ui.logger.debug { "@provider.send(#{method_name.inspect}, #{method_args.inspect})" }
      result = @provider.send(method_name, *method_args)
    else
      raise TestLab::ProviderError, "Your provider does not respond to the method '#{method_name}'!"
    end

    result
  else
    super(method_name, *method_args)
  end
end