gears.matcher: Fix `rule_every`.
It really didn't do the right thing and didn't work anyway.
This commit is contained in:
parent
8541637a85
commit
005c2d61a0
|
@ -133,7 +133,7 @@ end
|
|||
|
||||
-- Check if an object matches any part of a rule.
|
||||
-- @param o The object.
|
||||
-- #tparam table rule The rule _match_anyto check.
|
||||
-- @tparam table rule The rule to check.
|
||||
-- @treturn boolean True if at least one rule is matched, false otherwise.
|
||||
-- @method _match_any
|
||||
function matcher:_match_any(o, rule)
|
||||
|
@ -146,6 +146,7 @@ function matcher:_match_any(o, rule)
|
|||
return true
|
||||
end
|
||||
|
||||
|
||||
for _, value in ipairs(values) do
|
||||
if field_matcher(self, o, field, value) then
|
||||
return true
|
||||
|
@ -160,7 +161,7 @@ end
|
|||
-- Check if an object matches at least one of every part of a rule.
|
||||
--
|
||||
-- @param o The object.
|
||||
-- @tparam table rule The rule _match_anyto check.
|
||||
-- @tparam table rule The rule to check.
|
||||
-- @tparam boolean multi If the entries are table of choices.
|
||||
-- @treturn boolean True if all rules are matched.
|
||||
-- @method _match_every
|
||||
|
@ -170,7 +171,7 @@ function matcher:_match_every(o, rule)
|
|||
for field, values in pairs(rule) do
|
||||
local found = false
|
||||
for _, value in ipairs(values) do
|
||||
if not field_matcher(self, o, field, value) then
|
||||
if field_matcher(self, o, field, value) then
|
||||
found = true
|
||||
break
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue