Class: Roleback::OutcomeBase

Inherits:
Object
  • Object
show all
Defined in:
lib/roleback/outcome.rb

Direct Known Subclasses

Allow, Deny

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(outcome) ⇒ OutcomeBase

Returns a new instance of OutcomeBase.



5
6
7
# File 'lib/roleback/outcome.rb', line 5

def initialize(outcome)
	@outcome = outcome
end

Instance Attribute Details

#outcomeObject (readonly)

Returns the value of attribute outcome.



3
4
5
# File 'lib/roleback/outcome.rb', line 3

def outcome
  @outcome
end

Instance Method Details

#==(other) ⇒ Object



21
22
23
24
25
# File 'lib/roleback/outcome.rb', line 21

def ==(other)
	return false unless other.respond_to?(:outcome)

	other.outcome == outcome
end

#allowed?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/roleback/outcome.rb', line 9

def allowed?
	@outcome == :allow
end

#denied?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/roleback/outcome.rb', line 13

def denied?
	@outcome == :deny
end

#to_sObject



17
18
19
# File 'lib/roleback/outcome.rb', line 17

def to_s
	@outcome.to_s
end