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.



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

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

Instance Attribute Details

#actObject

Returns the value of attribute act.



4
5
6
# File 'lib/i_am_i_can/configs/config.rb', line 4

def act
  @act
end

#auto_define_beforeObject

Returns the value of attribute auto_define_before.



4
5
6
# File 'lib/i_am_i_can/configs/config.rb', line 4

def auto_define_before
  @auto_define_before
end

#default_saveObject

Returns the value of attribute default_save.



4
5
6
# File 'lib/i_am_i_can/configs/config.rb', line 4

def default_save
  @default_save
end

#permission_classObject

Returns the value of attribute permission_class.



4
5
6
# File 'lib/i_am_i_can/configs/config.rb', line 4

def permission_class
  @permission_class
end

#role_classObject

Returns the value of attribute role_class.



4
5
6
# File 'lib/i_am_i_can/configs/config.rb', line 4

def role_class
  @role_class
end

#role_group_classObject

Returns the value of attribute role_group_class.



4
5
6
# File 'lib/i_am_i_can/configs/config.rb', line 4

def role_group_class
  @role_group_class
end

#strict_modeObject

Returns the value of attribute strict_mode.



4
5
6
# File 'lib/i_am_i_can/configs/config.rb', line 4

def strict_mode
  @strict_mode
end

#subject_classObject

Returns the value of attribute subject_class.



4
5
6
# File 'lib/i_am_i_can/configs/config.rb', line 4

def subject_class
  @subject_class
end

#without_groupObject

Returns the value of attribute without_group.



4
5
6
# File 'lib/i_am_i_can/configs/config.rb', line 4

def without_group
  @without_group
end

Instance Method Details

#permission_modelObject



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

def permission_model
  @permission_model ||= permission_class.constantize
end

#role_group_modelObject



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

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

#role_modelObject



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

def role_model
  @role_model ||= role_class.constantize
end

#subject_modelObject



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

def subject_model
  @subject_model ||= subject_class.constantize
end