Module: TroleGroups::Operations::Write

Included in:
TroleGroups::Operations
Defined in:
lib/trole_groups/operations/write.rb

Instance Method Summary collapse

Instance Method Details

#+(*role_groups) ⇒ true, ... Also known as: <<, add, add!

Add a set of role_groups to the role subject

Parameters:

  • role_groups (Array<Symbol>)

    list to add

Returns:

  • (true, false, Error)

    true if added, false if static or invalid, Error on some error



17
18
19
# File 'lib/trole_groups/operations/write.rb', line 17

def + *role_groups
  rolegroup_subject.add_role_groups role_groups.to_symbols_uniq
end

#-(*role_groups) ⇒ true, ... Also known as: remove, remove!

Remove a set of role_groups from the role subject

Parameters:

  • role_groups (Array<Symbol>)

    list to add

Returns:

  • (true, false, Error)

    true if removed, false if static or invalid, Error on some error



27
28
29
# File 'lib/trole_groups/operations/write.rb', line 27

def - *role_groups
  rolegroup_subject.remove_role_groups role_groups.to_symbols_uniq
end

#==(*role_groups) ⇒ Object Also known as: equal, same_as

Test role_groups equality

Parameters:

  • role_groups (Array<Symbol>)

    list to test



8
9
10
# File 'lib/trole_groups/operations/write.rb', line 8

def == *role_groups
  rolegroup_subject.rolegroup_list == role_groups.to_symbols_uniq
end

#cleartrue, ... Also known as: clear!

Clear all the role_groups from the role subject

Parameters:

  • role_groups (Array<Symbol>)

    list to add

Returns:

  • (true, false, Error)

    true if removed, false if static or invalid, Error on some error



36
37
38
# File 'lib/trole_groups/operations/write.rb', line 36

def clear
  rolegroup_subject.clear_role_groups!
end