You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
slop.rb, which allows accessing data with help of method_missing, is missing respond_to_missing? which prevents usage of respond_to? to test whether data exists in the response.
I successfully used following piece of code to mitigate the problem:
module Nokogiri
module Decorators
module Slop
def respond_to_missing? name, include_private = false
prefix = implied_xpath_context
list = xpath("#{prefix}#{name.to_s.sub(/^_/, '')}")
return false if list.empty?
true
end
end
end
end
I took the implementation from method_missing in slop.rb, and disregarded args parts as I don’t know what for they are used and if they apply for this one.
The text was updated successfully, but these errors were encountered:
slop.rb, which allows accessing data with help of method_missing, is missing respond_to_missing? which prevents usage of respond_to? to test whether data exists in the response.
I successfully used following piece of code to mitigate the problem:
module Nokogiri
module Decorators
module Slop
def respond_to_missing? name, include_private = false
prefix = implied_xpath_context
list = xpath("#{prefix}#{name.to_s.sub(/^_/, '')}")
return false if list.empty?
true
end
end
end
end
I took the implementation from method_missing in slop.rb, and disregarded args parts as I don’t know what for they are used and if they apply for this one.
The text was updated successfully, but these errors were encountered: