class DeclarativePolicy::Rule::Not
Attributes
rule[R]
Public Class Methods
new(rule)
click to toggle source
# File lib/declarative_policy/rule.rb, line 282 def initialize(rule) @rule = rule end
Public Instance Methods
cached_pass?(context)
click to toggle source
# File lib/declarative_policy/rule.rb, line 299 def cached_pass?(context) case @rule.cached_pass?(context) when nil then nil when true then false when false then true end end
pass?(context)
click to toggle source
# File lib/declarative_policy/rule.rb, line 295 def pass?(context) !@rule.pass?(context) end
repr()
click to toggle source
# File lib/declarative_policy/rule.rb, line 311 def repr "~#{@rule.repr}" end
score(context)
click to toggle source
# File lib/declarative_policy/rule.rb, line 307 def score(context) @rule.score(context) end
simplify()
click to toggle source
# File lib/declarative_policy/rule.rb, line 286 def simplify case @rule when And then Or.new(@rule.rules.map(&:negate)).simplify when Or then And.new(@rule.rules.map(&:negate)).simplify when Not then @rule.rule.simplify else Not.new(@rule.simplify) end end