File tree 1 file changed +17
-3
lines changed
1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -149,12 +149,26 @@ def self.symbolize_keys hash
149
149
result
150
150
end
151
151
152
- def self . promote_singleton_appium_methods main_module
152
+ # if modules is a module instead of an array, then the constants of
153
+ # that module are promoted on.
154
+ # otherwise, the array of modules will be used as the promotion target.
155
+ def self . promote_singleton_appium_methods modules
153
156
raise 'Driver is nil' if $driver. nil?
154
- main_module . constants . each do |sub_module |
157
+
158
+ target_modules = [ ]
159
+
160
+ if modules . is_a? Module
161
+ modules . constants . each do |sub_module |
162
+ target_modules << modules . const_get ( sub_module )
163
+ end
164
+ else
165
+ raise 'modules must be a module or an array' unless modules . is_a? Array
166
+ target_modules = modules
167
+ end
168
+
169
+ target_modules . each do |const |
155
170
#noinspection RubyResolve
156
171
$driver. public_methods ( false ) . each do |m |
157
- const = main_module . const_get ( sub_module )
158
172
const . send ( :define_singleton_method , m ) do |*args , &block |
159
173
begin
160
174
super ( *args , &block ) # promote.rb
You can’t perform that action at this time.
0 commit comments