Class: CanTango::Configuration::RoleGroups

Inherits:
RoleRegistry show all
Includes:
Singleton
Defined in:
lib/cantango/configuration/role_groups.rb

Instance Attribute Summary

Attributes inherited from RoleRegistry

#has_method, #list_method

Attributes inherited from Registry

#default, #registered

Instance Method Summary collapse

Methods inherited from RoleRegistry

#clear!, #exclude, #excluded, #filter?, #onlies, #only

Methods inherited from Registry

#[], #clean!, #default!, #register, #registered?, #types, #types=

Instance Method Details

#add_role_group_system(role_system_hash) ⇒ Object

Raises:

  • (ArgumentError)


20
21
22
23
# File 'lib/cantango/configuration/role_groups.rb', line 20

def add_role_group_system role_system_hash
  raise ArgumentError, "Must be a hash fx :troles => :role_list, was: #{role_system_hash}" if !role_system_hash.kind_of?(Hash)
  role_groups_list_map.merge! role_system
end

#default_has_methodObject



25
26
27
# File 'lib/cantango/configuration/role_groups.rb', line 25

def default_has_method
  role_group_methods[:has] || :in_role_group?
end

#default_list_methodObject



29
30
31
# File 'lib/cantango/configuration/role_groups.rb', line 29

def default_list_method
   role_group_methods[:list] || :role_groups_list
end

#role_group_methodsObject



33
34
35
# File 'lib/cantango/configuration/role_groups.rb', line 33

def role_group_methods
  role_groups_list_map[role_group_system] || {}
end

#role_group_systemObject



16
17
18
# File 'lib/cantango/configuration/role_groups.rb', line 16

def role_group_system
  @role_group_system ||= :troles
end

#role_group_system=(name) ⇒ Object

Raises:

  • (ArgumentError)


6
7
8
9
# File 'lib/cantango/configuration/role_groups.rb', line 6

def role_group_system= name
  raise ArgumentError, "Must be a label" if !name.kind_of_label?
  @role_group_system = name.to_sym
end

#role_groups_list_mapObject



37
38
39
40
41
# File 'lib/cantango/configuration/role_groups.rb', line 37

def role_groups_list_map
  @role_groups_list_map ||= {
    :troles => {:list => :role_group_list}
  }
end

#role_groups_list_map=(role_systems_hash) ⇒ Object

Raises:

  • (ArgumentError)


11
12
13
14
# File 'lib/cantango/configuration/role_groups.rb', line 11

def role_groups_list_map= role_systems_hash
  raise ArgumentError, "Must be a hash fx :troles => :role_list, was: #{role_systems_hash}" if !role_systems_hash.kind_of?(Hash)
  @role_groups_list_map = role_systems_hash
end