lib/appium_lib/driver.rb in appium_lib-0.5.14 vs lib/appium_lib/driver.rb in appium_lib-0.5.15

- old
+ new

@@ -189,16 +189,17 @@ @@loaded = true # Promote Appium driver methods to Object instance methods. $driver.public_methods(false).each do | m | Object.class_eval do define_method m do | *args, &block | - if defined?(super) # check if method is defined on super - # puts "[Object.class_eval] Calling super for #{m}" + begin + # puts "[Object.class_eval] Calling super for '#{m}'" # prefer existing method. + # super will invoke method missing on driver super(*args, &block) - else - # puts '[Object.class_eval] not on super, calling driver.' - $driver.send m, *args, &block + rescue NoMethodError + # puts "[Object.class_eval] '#{m}' not on super" + $driver.send m, *args, &block if $driver.respond_to?(m) end end end end end