Module: Erbac::Configure

Included in:
Erbac
Defined in:
lib/erbac/configure.rb

Constant Summary collapse

USER_CLASS =
"User"
AUTH_ITEM =
"auth_item"
AUTH_ITEM_CLASS =
AUTH_ITEM.dup.classify
AUTH_ITEM_TABLE =
AUTH_ITEM.dup.tableize
AUTH_ITEM_CHILD =
"auth_item_child"
AUTH_ITEM_CHILD_TABLE =
AUTH_ITEM_CHILD.dup.tableize
AUTH_ASSIGNMENT =
"auth_assignment"
AUTH_ASSIGNMENT_CLASS =
AUTH_ASSIGNMENT.dup.classify
AUTH_ASSIGNMENT_TABLE =
AUTH_ASSIGNMENT.dup.tableize

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#auth_assignmentObject

Returns the value of attribute auth_assignment.



21
22
23
# File 'lib/erbac/configure.rb', line 21

def auth_assignment
  @auth_assignment
end

#auth_assignment_classObject

Returns the value of attribute auth_assignment_class.



21
22
23
# File 'lib/erbac/configure.rb', line 21

def auth_assignment_class
  @auth_assignment_class
end

#auth_assignment_tableObject

Returns the value of attribute auth_assignment_table.



21
22
23
# File 'lib/erbac/configure.rb', line 21

def auth_assignment_table
  @auth_assignment_table
end

#auth_itemObject

Returns the value of attribute auth_item.



12
13
14
# File 'lib/erbac/configure.rb', line 12

def auth_item
  @auth_item
end

#auth_item_childObject

Returns the value of attribute auth_item_child.



16
17
18
# File 'lib/erbac/configure.rb', line 16

def auth_item_child
  @auth_item_child
end

#auth_item_child_tableObject

Returns the value of attribute auth_item_child_table.



16
17
18
# File 'lib/erbac/configure.rb', line 16

def auth_item_child_table
  @auth_item_child_table
end

#auth_item_classObject

Returns the value of attribute auth_item_class.



12
13
14
# File 'lib/erbac/configure.rb', line 12

def auth_item_class
  @auth_item_class
end

#auth_item_tableObject

Returns the value of attribute auth_item_table.



12
13
14
# File 'lib/erbac/configure.rb', line 12

def auth_item_table
  @auth_item_table
end

#default_rolesObject

Returns the value of attribute default_roles.



4
5
6
# File 'lib/erbac/configure.rb', line 4

def default_roles
  @default_roles
end

#strict_check_modeObject

Returns the value of attribute strict_check_mode.



3
4
5
# File 'lib/erbac/configure.rb', line 3

def strict_check_mode
  @strict_check_mode
end

#user_classObject

Returns the value of attribute user_class.



7
8
9
# File 'lib/erbac/configure.rb', line 7

def user_class
  @user_class
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/erbac/configure.rb', line 23

def configure
  yield self if block_given?

  self.strict_check_mode ||= true
  self.default_roles ||= []

  self.user_class ||= USER_CLASS

  self.auth_item ||= AUTH_ITEM
	self.auth_item_class ||= self.auth_item.classify
	self.auth_item_table ||= self.auth_item.tableize

	self.auth_item_child ||= AUTH_ITEM_CHILD
	self.auth_item_child_table ||= self.auth_item_child.tableize

	self.auth_assignment ||= AUTH_ASSIGNMENT
	self.auth_assignment_class ||= self.auth_assignment.classify
	self.auth_assignment_table ||= self.auth_assignment.tableize
end