Module: Class::ChainMethods
- Defined in:
- lib/define_method_handler.rb
Instance Method Summary collapse
- #disable_handler_group(groupname, mname = self.class.method_handlers.keys.first) ⇒ Object
- #disabled_handler_groups ⇒ Object
- #enable_handler_group(groupname, mname = self.class.method_handlers.keys.first) ⇒ Object
Instance Method Details
#disable_handler_group(groupname, mname = self.class.method_handlers.keys.first) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/define_method_handler.rb', line 92 def disable_handler_group(groupname, mname = self.class.method_handlers.keys.first) if block_given? old_groups = (disabled_handler_groups[mname]||Set.new).dup begin disable_handler_group(groupname,mname) yield ensure self.disabled_handler_groups[mname] = old_groups end else disabled_handler_groups[mname] ||= Set.new disabled_handler_groups[mname] << groupname end end |
#disabled_handler_groups ⇒ Object
72 73 74 |
# File 'lib/define_method_handler.rb', line 72 def disabled_handler_groups @disabled_handler_groups ||= Hash.new end |
#enable_handler_group(groupname, mname = self.class.method_handlers.keys.first) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/define_method_handler.rb', line 76 def enable_handler_group(groupname, mname = self.class.method_handlers.keys.first) group_included = false if block_given? old_groups = (disabled_handler_groups[mname]||Set.new).dup begin enable_handler_group(groupname,mname) yield ensure self.disabled_handler_groups[mname] = old_groups end else disabled_handler_groups[mname] ||= Set.new disabled_handler_groups[mname].delete(groupname) end end |