Class: Mocktail::StringifiesCall
- Inherits:
-
Object
- Object
- Mocktail::StringifiesCall
- Extended by:
- T::Sig
- Defined in:
- lib/mocktail/share/stringifies_call.rb,
lib/mocktail/sorbet/mocktail/share/stringifies_call.rb
Instance Method Summary collapse
- #stringify(call, anonymous_blocks: false, always_parens: false) ⇒ Object
- #stringify_multiple(calls, nonzero_message:, zero_message:, anonymous_blocks: false, always_parens: false) ⇒ Object
Instance Method Details
#stringify(call, anonymous_blocks: false, always_parens: false) ⇒ Object
5 6 7 |
# File 'lib/mocktail/share/stringifies_call.rb', line 5 def stringify(call, anonymous_blocks: false, always_parens: false) "#{call.method}#{args_to_s(call, parens: always_parens)}#{blockify(call.block, anonymous: anonymous_blocks)}" end |
#stringify_multiple(calls, nonzero_message:, zero_message:, anonymous_blocks: false, always_parens: false) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/mocktail/share/stringifies_call.rb', line 9 def stringify_multiple(calls, nonzero_message:, zero_message:, anonymous_blocks: false, always_parens: false) if calls.empty? "#{}.\n" else <<~MSG #{}: #{calls.map { |call| " " + stringify(call) }.join("\n\n")} MSG end end |