Sha256: 54d70cd997a3f4b69665e67f3bcbea4ac603b6740c0b3e6fc466c9a1bcd9409a

Contents?: true

Size: 918 Bytes

Versions: 1

Compression:

Stored size: 918 Bytes

Contents

module RR
  module Injections
    class Injection
      class << self
        def instances
          @instances ||= HashWithObjectIdKey.new
        end
      end

      include Space::Reader

      attr_reader :subject

      def subject_has_method_defined?(method_name_in_question)
        @subject.methods.detect {|method_name| method_name.to_sym == method_name_in_question.to_sym} ||
          @subject.protected_methods.detect {|method_name| method_name.to_sym == method_name_in_question.to_sym} ||
          @subject.private_methods.detect {|method_name| method_name.to_sym == method_name_in_question.to_sym}
      end

      def subject_has_original_method?
        subject_respond_to_method?(original_method_alias_name)
      end

      protected
      def subject_respond_to_method?(method_name)
        subject_has_method_defined?(method_name) || @subject.respond_to?(method_name)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rr-0.10.11 lib/rr/injections/injection.rb