Module: Rolify::Configure

Included in:
Rolify
Defined in:
lib/rolify/configure.rb

Constant Summary collapse

@@dynamic_shortcuts =
false
@@orm =
"active_record"
@@remove_role_if_empty =
true

Instance Method Summary collapse

Instance Method Details

#configure(*role_cnames) {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



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

def configure(*role_cnames)
  return if !sanity_check(role_cnames)
  yield self if block_given?
end

#dynamic_shortcutsObject



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

def dynamic_shortcuts
  @@dynamic_shortcuts
end

#dynamic_shortcuts=(is_dynamic) ⇒ Object



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

def dynamic_shortcuts=(is_dynamic)
  @@dynamic_shortcuts = is_dynamic
end

#ormObject



20
21
22
# File 'lib/rolify/configure.rb', line 20

def orm
  @@orm
end

#orm=(orm) ⇒ Object



24
25
26
# File 'lib/rolify/configure.rb', line 24

def orm=(orm)
  @@orm = orm
end

#remove_role_if_emptyObject



48
49
50
# File 'lib/rolify/configure.rb', line 48

def remove_role_if_empty
  @@remove_role_if_empty
end

#remove_role_if_empty=(is_remove) ⇒ Object



44
45
46
# File 'lib/rolify/configure.rb', line 44

def remove_role_if_empty=(is_remove)
  @@remove_role_if_empty = is_remove
end

#use_defaultsObject



37
38
39
40
41
42
# File 'lib/rolify/configure.rb', line 37

def use_defaults
  configure do |config|
    config.dynamic_shortcuts = false
    config.orm = "active_record"
  end
end

#use_dynamic_shortcutsObject



32
33
34
35
# File 'lib/rolify/configure.rb', line 32

def use_dynamic_shortcuts
  return if !sanity_check([])
  self.dynamic_shortcuts = true
end

#use_mongoidObject



28
29
30
# File 'lib/rolify/configure.rb', line 28

def use_mongoid
  self.orm = "mongoid"
end