Module: CanTango::Config::Permits::Disabling
- Included in:
- CanTango::Config::Permits
- Defined in:
- lib/cantango/permits_ext/config/permits/disabling.rb
Instance Method Summary collapse
- #disable_for(type, *names) ⇒ Object
- #disabled ⇒ Object
- #disabled?(type, *names) ⇒ Boolean
- #disabled_for(type) ⇒ Object
Instance Method Details
#disable_for(type, *names) ⇒ Object
4 5 6 7 |
# File 'lib/cantango/permits_ext/config/permits/disabling.rb', line 4 def disable_for type, *names @disabled ||= {} @disabled[type.to_sym] = names.to_symbols end |
#disabled ⇒ Object
9 10 11 |
# File 'lib/cantango/permits_ext/config/permits/disabling.rb', line 9 def disabled @disabled ||= {} end |
#disabled?(type, *names) ⇒ Boolean
13 14 15 |
# File 'lib/cantango/permits_ext/config/permits/disabling.rb', line 13 def disabled? type, *names (names.flatten - disabled_for(type)).empty? end |
#disabled_for(type) ⇒ Object
17 18 19 |
# File 'lib/cantango/permits_ext/config/permits/disabling.rb', line 17 def disabled_for type disabled[type.to_sym] || [] end |