Class: Mocktail::ExplainsThing
- Inherits:
-
Object
- Object
- Mocktail::ExplainsThing
- Extended by:
- T::Sig
- Defined in:
- lib/mocktail/explains_thing.rb,
lib/mocktail/sorbet/mocktail/explains_thing.rb
Instance Method Summary collapse
- #explain(thing) ⇒ Object
-
#initialize ⇒ ExplainsThing
constructor
A new instance of ExplainsThing.
Constructor Details
#initialize ⇒ ExplainsThing
Returns a new instance of ExplainsThing.
8 9 10 11 |
# File 'lib/mocktail/explains_thing.rb', line 8 def initialize @stringifies_method_name = StringifiesMethodName.new @stringifies_call = StringifiesCall.new end |
Instance Method Details
#explain(thing) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/mocktail/explains_thing.rb', line 13 def explain(thing) if (double = Mocktail.cabinet.double_for_instance(thing)) double_explanation(double) elsif (thing.is_a?(Module) || thing.is_a?(Class)) && (type_replacement = TopShelf.instance.type_replacement_if_exists_for(thing)) replaced_type_explanation(type_replacement) elsif (fake_method_explanation = fake_method_explanation_for(thing)) fake_method_explanation else no_explanation(thing) end end |