lib/appium_lib/driver.rb in appium_lib-0.5.12 vs lib/appium_lib/driver.rb in appium_lib-0.5.13
- old
+ new
@@ -189,18 +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 |
- begin
- # puts "[Object.class_eval] Calling super for #{m}"
- # prefer existing method.
- # super will invoke method missing on driver
- super(*args, &block)
- rescue NoMethodError
- # puts '[Object.class_eval] NoMethodError'
- $driver.send m, *args, &block
- end
+ if defined?(super) # check if method is defined on super
+ # puts "[Object.class_eval] Calling super for #{m}"
+ # prefer existing method.
+ super(*args, &block)
+ else
+ # puts '[Object.class_eval] not on super, calling driver.'
+ $driver.send m, *args, &block
+ end
end
end
end
end