Class: Troles::Common::Operations

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Read, Write
Defined in:
lib/troles/common/operations.rb,
lib/troles/common/operations/read.rb,
lib/troles/common/operations/write.rb

Direct Known Subclasses

Operations

Defined Under Namespace

Modules: Read, Write

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Write

#+, #-, #==, #clear

Methods included from Read

#has?, #list, #used

Constructor Details

#initialize(role_subject) ⇒ Operations

constructor

Parameters:

  • the (Object)

    role subject, fx a User or UserAccount



22
23
24
# File 'lib/troles/common/operations.rb', line 22

def initialize role_subject
  @role_subject = role_subject
end

Instance Attribute Details

#role_subjectObject (readonly)

Returns the value of attribute role_subject.



18
19
20
# File 'lib/troles/common/operations.rb', line 18

def role_subject
  @role_subject
end

Instance Method Details

#eachObject

required method to act as enumerable iterates and yields all roles in the role list (Symbols)



28
29
30
# File 'lib/troles/common/operations.rb', line 28

def each
  list.each { |role| yield role }
end