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.
|
-- Check if an object matches any part of a rule.
|
||||||
-- @param o The object.
|
-- @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.
|
-- @treturn boolean True if at least one rule is matched, false otherwise.
|
||||||
-- @method _match_any
|
-- @method _match_any
|
||||||
function matcher:_match_any(o, rule)
|
function matcher:_match_any(o, rule)
|
||||||
|
@ -146,6 +146,7 @@ function matcher:_match_any(o, rule)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
for _, value in ipairs(values) do
|
for _, value in ipairs(values) do
|
||||||
if field_matcher(self, o, field, value) then
|
if field_matcher(self, o, field, value) then
|
||||||
return true
|
return true
|
||||||
|
@ -160,7 +161,7 @@ end
|
||||||
-- Check if an object matches at least one of every part of a rule.
|
-- Check if an object matches at least one of every part of a rule.
|
||||||
--
|
--
|
||||||
-- @param o The object.
|
-- @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.
|
-- @tparam boolean multi If the entries are table of choices.
|
||||||
-- @treturn boolean True if all rules are matched.
|
-- @treturn boolean True if all rules are matched.
|
||||||
-- @method _match_every
|
-- @method _match_every
|
||||||
|
@ -170,7 +171,7 @@ function matcher:_match_every(o, rule)
|
||||||
for field, values in pairs(rule) do
|
for field, values in pairs(rule) do
|
||||||
local found = false
|
local found = false
|
||||||
for _, value in ipairs(values) do
|
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
|
found = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue