Class: PickyGuard::Statement

Inherits:
Object
  • Object
show all
Defined in:
lib/picky_guard/statement.rb

Constant Summary collapse

EFFECT_ALLOW =
:allow
EFFECT_DENY =
:deny
EFFECTS =
[EFFECT_ALLOW, EFFECT_DENY].freeze
RESOURCE_TYPE_INSTANCE =
:instance
RESOURCE_TYPE_CLASS =
:class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(effect, actions, resource, conditions) ⇒ Statement

Returns a new instance of Statement.



16
17
18
19
20
21
# File 'lib/picky_guard/statement.rb', line 16

def initialize(effect, actions, resource, conditions)
  @effect = effect
  @actions = actions
  @resource = resource
  @conditions = conditions
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



7
8
9
# File 'lib/picky_guard/statement.rb', line 7

def actions
  @actions
end

#conditionsObject (readonly)

Returns the value of attribute conditions.



7
8
9
# File 'lib/picky_guard/statement.rb', line 7

def conditions
  @conditions
end

#effectObject (readonly)

Returns the value of attribute effect.



7
8
9
# File 'lib/picky_guard/statement.rb', line 7

def effect
  @effect
end

#resourceObject (readonly)

Returns the value of attribute resource.



7
8
9
# File 'lib/picky_guard/statement.rb', line 7

def resource
  @resource
end

Instance Method Details

#allow?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/picky_guard/statement.rb', line 23

def allow?
  @effect == EFFECT_ALLOW
end

#deny?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/picky_guard/statement.rb', line 27

def deny?
  @effect == EFFECT_DENY
end