lib/appium_lib/common/helper.rb in appium_lib-11.0.0 vs lib/appium_lib/common/helper.rb in appium_lib-11.1.0
- old
+ new
@@ -27,11 +27,12 @@
# find_element :text doesn't work so use XPath to find by text.
# Return yield and ignore any exceptions.
def ignore
yield
- rescue Exception # rubocop:disable Lint/HandleExceptions, Lint/RescueException
+ rescue Exception # rubocop:disable Lint/RescueException
+ # Ignored
end
# Navigate back.
# @return [void]
def back
@@ -71,11 +72,11 @@
# @private
# http://nokogiri.org/Nokogiri/XML/SAX.html
class CountElements < Nokogiri::XML::SAX::Document
attr_reader :result
- def initialize(platform)
+ def initialize(platform) # rubocop:disable Lint/MissingSuper
reset
@platform = platform
end
def reset
@@ -211,11 +212,11 @@
return @filter = false unless value # rubocop:disable Lint/ReturnInVoidContext
@filter = value.to_s.downcase
end
- def initialize
+ def initialize # rubocop:disable Lint/MissingSuper
reset
@filter = false
end
def reset
@@ -230,11 +231,12 @@
attr_string = e.reduce('') do |string, attr|
attr1 = attr[1] ? attr[1].strip : attr[1]
"#{string} #{attr[0]}: #{attr1}\n"
end
- r.concat "\n#{name}\n#{attr_string}" unless attr_string.nil? || attr_string.empty?
- r
+ return r if attr_string.nil? || attr_string.empty?
+
+ "#{r}\n#{name}\n#{attr_string}"
end
end
def start_element(name, attrs = [])
@skip_element = filter && !filter.include?(name.downcase)