Class: Mocktail::GathersFakeableInstanceMethods
- Inherits:
-
Object
- Object
- Mocktail::GathersFakeableInstanceMethods
- Extended by:
- T::Sig
- Defined in:
- lib/mocktail/imitates_type/makes_double/gathers_fakeable_instance_methods.rb,
lib/mocktail/sorbet/mocktail/imitates_type/makes_double/gathers_fakeable_instance_methods.rb
Instance Method Summary collapse
Instance Method Details
#gather(type) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/mocktail/imitates_type/makes_double/gathers_fakeable_instance_methods.rb', line 5 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 |
#ignore?(type, method_name) ⇒ Boolean
15 16 17 |
# File 'lib/mocktail/imitates_type/makes_double/gathers_fakeable_instance_methods.rb', line 15 def ignore?(type, method_name) ignored_ancestors.include?(type.instance_method(method_name).owner) end |
#ignored_ancestors ⇒ Object
19 20 21 |
# File 'lib/mocktail/imitates_type/makes_double/gathers_fakeable_instance_methods.rb', line 19 def ignored_ancestors Object.ancestors end |