1 2 3 4 5 6 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 33
|
module RR
module Injections
class Injection
extend(Module.new do
def instances
@instances ||= HashWithObjectIdKey.new
end
end)
include Space::Reader
include ClassInstanceMethodDefined
def subject_has_method_defined?(method_name_in_question)
class_instance_method_defined(subject_class, method_name_in_question)
end
def subject_has_original_method?
subject_has_method_defined?(original_method_alias_name)
end
def original_method
subject_class.instance_method(original_method_alias_name)
end
protected
def subject_respond_to_method?(subject, method_name)
subject_has_method_defined?(method_name) ||
class_instance_method_defined(subject_class, :respond_to?) &&
subject.respond_to?(method_name)
end
end
end
end
|