Sha256: 4dd6bb6559dfb30cd25caf6429a5f7f5a2582e7148135bf284005fb6adff6d13

Contents?: true

Size: 493 Bytes

Versions: 1

Compression:

Stored size: 493 Bytes

Contents

module Mocktail
  class GathersFakeableInstanceMethods
    extend T::Sig

    def gather(type)
      methods = type.instance_methods + [
        (:respond_to_missing? if type.private_method_defined?(:respond_to_missing?))
      ].compact

      methods.reject { |m|
        ignore?(type, m)
      }
    end

    def ignore?(type, method_name)
      ignored_ancestors.include?(type.instance_method(method_name).owner)
    end

    def ignored_ancestors
      Object.ancestors
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mocktail-2.0.0 lib/mocktail/imitates_type/makes_double/gathers_fakeable_instance_methods.rb