Class: Bali::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/bali/rule.rb

Overview

for internal use, representing rule

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auth_val, operation) ⇒ Rule

Returns a new instance of Rule.



12
13
14
15
16
# File 'lib/bali/rule.rb', line 12

def initialize(auth_val, operation)
  self.auth_val = auth_val
  @operation = operation
  self
end

Instance Attribute Details

#auth_valObject

auth_val is either :can or :cant



4
5
6
# File 'lib/bali/rule.rb', line 4

def auth_val
  @auth_val
end

#deciderObject

if decider is defined, a rule is executed only if decider evaluates to true



10
11
12
# File 'lib/bali/rule.rb', line 10

def decider
  @decider
end

#operationObject (readonly)

what is the operation: create, update, delete, or any other



7
8
9
# File 'lib/bali/rule.rb', line 7

def operation
  @operation
end

Instance Method Details

#has_decider?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/bali/rule.rb', line 30

def has_decider?
  self.decider.is_a?(Proc)
end

#is_discouragement?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/bali/rule.rb', line 26

def is_discouragement?
  self.auth_val == :cant
end