Module: Appium
- Defined in:
- lib/appium_lib.rb,
lib/appium_lib/common/version.rb,
lib/appium_lib/android/dynamic.rb,
lib/appium_lib/driver.rb
Defined Under Namespace
Modules: Android, Common, Ios Classes: Driver
Constant Summary collapse
- VERSION =
Version and Date are defined on the ‘Appium’ module, not ‘Appium::Common’
'0.6.7'- DATE =
'2013-08-23'
Class Method Summary collapse
- .add_to_path(file, path = false) ⇒ Object
-
.promote_appium_methods(class_array) ⇒ Object
Promote appium methods to class instance methods.
Class Method Details
.add_to_path(file, path = false) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/appium_lib.rb', line 24 def self.add_to_path file, path=false path = path ? "../#{path}/" : '..' path = File. path, file $:.unshift path unless $:.include? path end |
.promote_appium_methods(class_array) ⇒ Object
Promote appium methods to class instance methods
To promote methods to all classes:
“‘ruby Appium.promote_appium_methods Object “`
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/appium_lib/driver.rb', line 165 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 |