Remove unnecessary tag rule code

The applicator converts the input to an array, even `nil` becomes an
empty array. Iterating over an empty array doesn't do anything either,
the result is the same.
This commit is contained in:
Maikel Linke
2023-03-01 13:27:08 +11:00
parent e227cb912b
commit eee5e8eee7

View File

@@ -14,8 +14,6 @@ module OpenFoodNetwork
end
def filter!(subject)
return unless subject.respond_to?(:any?) && subject.any?
subject.to_a.reject! do |element|
if rule_class.respond_to?(:tagged_children_for)
children = rule_class.tagged_children_for(element)