Module: IAmICan::Configs
- Defined in:
- lib/i_am_i_can/configs/config.rb,
lib/i_am_i_can/configs/configs.rb
Defined Under Namespace
Classes: Config
Class Method Summary collapse
- .get(class_name) ⇒ Object
- .set_for(subject:, role:, permission:, role_group: nil, &block) ⇒ Object
- .take ⇒ Object
Class Method Details
.get(class_name) ⇒ Object
21 22 23 |
# File 'lib/i_am_i_can/configs/configs.rb', line 21 def self.get(class_name) configs[class_name] end |
.set_for(subject:, role:, permission:, role_group: nil, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/i_am_i_can/configs/configs.rb', line 9 def self.set_for(subject:, role:, permission:, role_group: nil, &block) config = Config.new(subject, role, , role_group) config.instance_eval(&block) configs.merge!( subject => config.dup, role => config.dup, => config.dup, ) configs.merge!(role_group => config.dup) if role_group config end |
.take ⇒ Object
25 26 27 |
# File 'lib/i_am_i_can/configs/configs.rb', line 25 def self.take configs.values.first end |