RolifyCommunity / rolify

Role management library with resource scoping
https://rolifycommunity.github.io/rolify/
MIT License
3.16k stars 404 forks source link

Enable short-circuiting in has_cached_role #560

Open thomas-mcdonald opened 3 years ago

thomas-mcdonald commented 3 years ago

Rather than iterate through the entire roles array and then report if there are any values returned, we can instead use any? with a block that will short-circuit when the first truthy value is returned.

This changes the call signature for RoleAdapter#find_cached* to return boolean rather than an array

reopening #519 not-as-a-fork to get actions building