Sha256: d59f47bccd644918310ccc53343f720cac4541d62fb79d5cdbf6d01385295303
Contents?: true
Size: 1017 Bytes
Versions: 1
Compression:
Stored size: 1017 Bytes
Contents
require "method_watcher/version" module MethodWatcher class << self def included mod mod.instance_variable_set "@_watch_methods", {} mod.singleton_class.class_eval do def watch_methods *methods methods.each do |method| watch_method method end end def watch_method method @_watch_methods[method.to_sym] = self end def method_added method super if @_watch_methods.has_key?(method.to_sym) @_watch_methods[method].method_overriding method end end def method_overriding method warn "method #{self}##{method} is overridden" end def inherited mod super super_watch_methods = (mod.respond_to?(:superclass) && mod.superclass && mod.superclass.instance_variable_get("@_watch_methods")) || {} mod.instance_variable_set "@_watch_methods", super_watch_methods.merge({}) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
method_watcher-0.0.1 | lib/method_watcher.rb |