Class: IAmICan::Configs::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/i_am_i_can/configs/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*classes) ⇒ Config

Returns a new instance of Config.



9
10
11
12
13
14
# File 'lib/i_am_i_can/configs/config.rb', line 9

def initialize(*classes)
  self.subject_class, self.role_class, self.permission_class, self.role_group_class = classes
  self.auto_definition = false
  self.strict_mode = false
  self.without_group = false
end

Instance Attribute Details

#actObject

Returns the value of attribute act.



6
7
8
# File 'lib/i_am_i_can/configs/config.rb', line 6

def act
  @act
end

#auto_definitionObject

Returns the value of attribute auto_definition.



6
7
8
# File 'lib/i_am_i_can/configs/config.rb', line 6

def auto_definition
  @auto_definition
end

#permission_classObject

Returns the value of attribute permission_class.



6
7
8
# File 'lib/i_am_i_can/configs/config.rb', line 6

def permission_class
  @permission_class
end

#role_classObject

Returns the value of attribute role_class.



6
7
8
# File 'lib/i_am_i_can/configs/config.rb', line 6

def role_class
  @role_class
end

#role_group_classObject

Returns the value of attribute role_group_class.



6
7
8
# File 'lib/i_am_i_can/configs/config.rb', line 6

def role_group_class
  @role_group_class
end

#strict_modeObject

Returns the value of attribute strict_mode.



6
7
8
# File 'lib/i_am_i_can/configs/config.rb', line 6

def strict_mode
  @strict_mode
end

#subject_classObject

Returns the value of attribute subject_class.



6
7
8
# File 'lib/i_am_i_can/configs/config.rb', line 6

def subject_class
  @subject_class
end

#without_groupObject

Returns the value of attribute without_group.



6
7
8
# File 'lib/i_am_i_can/configs/config.rb', line 6

def without_group
  @without_group
end

Instance Method Details

#permission_modelObject



28
29
30
# File 'lib/i_am_i_can/configs/config.rb', line 28

def permission_model
  @permission_model ||= permission_class.constantize
end

#role_group_modelObject



24
25
26
# File 'lib/i_am_i_can/configs/config.rb', line 24

def role_group_model
  @role_group_model ||= role_group_class.constantize rescue nil
end

#role_modelObject



20
21
22
# File 'lib/i_am_i_can/configs/config.rb', line 20

def role_model
  @role_model ||= role_class.constantize
end

#subject_modelObject



16
17
18
# File 'lib/i_am_i_can/configs/config.rb', line 16

def subject_model
  @subject_model ||= subject_class.constantize
end