# File lib/rr/injections/singleton_method_added_injection.rb, line 5 5: def create(subject) 6: instances[subject] ||= begin 7: new(subject).bind 8: end 9: end
# File lib/rr/injections/singleton_method_added_injection.rb, line 21 21: def bind 22: unless subject.respond_to?(original_method_alias_name) 23: unless subject.respond_to?(:singleton_method_added) 24: @placeholder_method_defined = true 25: subject_class.class_eval do 26: def singleton_method_added(method_name) 27: super 28: end 29: end 30: end 31: 32: memoized_subject = subject 33: memoized_original_method_alias_name = original_method_alias_name 34: subject_class.__send__(:alias_method, original_method_alias_name, :singleton_method_added) 35: subject_class.__send__(:define_method, :singleton_method_added) do |method_name_arg| 36: if Injections::DoubleInjection.exists?(memoized_subject, method_name_arg) 37: Injections::DoubleInjection.create(memoized_subject, method_name_arg).send(:deferred_bind_method) 38: end 39: send(memoized_original_method_alias_name, method_name_arg) 40: end 41: end 42: self 43: end
# File lib/rr/injections/singleton_method_added_injection.rb, line 45 45: def reset 46: if subject_has_method_defined?(original_method_alias_name) 47: memoized_original_method_alias_name = original_method_alias_name 48: placeholder_method_defined = @placeholder_method_defined 49: subject_class.class_eval do 50: remove_method :singleton_method_added 51: unless placeholder_method_defined 52: alias_method :singleton_method_added, memoized_original_method_alias_name 53: end 54: remove_method memoized_original_method_alias_name 55: end 56: end 57: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.