module Appium

def self.add_to_path file, path=false

Other tags:
    Private: -
def self.add_to_path file, path=false
  path = path ? "../#{path}/" : '..'
  path = File.expand_path path, file
  $:.unshift path unless $:.include? path
end

def self.promote_appium_methods class_array

def self.promote_appium_methods class_array
  raise 'Driver is nil' if $driver.nil?
  # Wrap single class into an array
  class_array = [class_array] unless class_array.class == Array
  # Promote Appium driver methods to class instance methods.
  class_array.each do |klass|
    $driver.public_methods(false).each do |m|
      klass.class_eval do
        define_method m do |*args, &block|
          begin
            # Prefer existing method.
            # super will invoke method missing on driver
            super(*args, &block)
            # minitest also defines a name method,
            # so rescue argument error
            # and call the name method on $driver
          rescue NoMethodError, ArgumentError
            $driver.send m, *args, &block if $driver.respond_to?(m)
          end
        end
      end
    end
  end
  nil # return nil
end