Class: ActionPolicy::Policy::PreCheck::Check::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/action_policy/policy/pre_check.rb

Overview

Wrapper over check result

Constant Summary collapse

DENY =
:__deny__
ALLOW =
:__allow__
KINDS =
{
  DENY => false,
  ALLOW => true
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(val) ⇒ Result

Returns a new instance of Result.



46
47
48
49
# File 'lib/action_policy/policy/pre_check.rb', line 46

def initialize(val)
  @fulfilled = KINDS.keys.include?(val)
  @value = val
end

Instance Attribute Details

#fulfilledObject (readonly) Also known as: fulfilled?

Returns the value of attribute fulfilled.



44
45
46
# File 'lib/action_policy/policy/pre_check.rb', line 44

def fulfilled
  @fulfilled
end

Instance Method Details

#denied?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/action_policy/policy/pre_check.rb', line 53

def denied?
  @value == DENY
end

#valueObject



57
58
59
# File 'lib/action_policy/policy/pre_check.rb', line 57

def value
  KINDS.fetch(@value)
end