Module: NoPatch
- Defined in:
- lib/no_patch.rb,
lib/no_patch/version.rb
Defined Under Namespace
Classes: RedifinitionError, Version
Constant Summary collapse
Class Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/no_patch.rb', line 7 def self.included(klass) def klass.method_added(sym) raise RedifinitionError if self.immutable_instance_methods.include? sym @immutable_instance_methods << sym super end # Heads up, this calls itself after being defined def klass.singleton_method_added(sym) @immutable_class_methods ||= [] raise RedifinitionError if @immutable_class_methods.include? sym @immutable_class_methods << sym super end private def klass.immutable_instance_methods @immutable_instance_methods ||= [] end def klass.immutable_class_methods @immutable_class_methods ||= [] end end |