Class: Spoom::Coverage::SnapshotPrinter

Inherits:
Printer
  • Object
show all
Defined in:
lib/spoom/coverage/snapshot.rb

Instance Attribute Summary

Attributes inherited from Printer

#out

Instance Method Summary collapse

Methods inherited from Printer

#colorize, #dedent, #indent, #initialize, #print, #print_colored, #printl, #printn, #printt

Methods included from Spoom::Colorize

#set_color

Constructor Details

This class inherits a constructor from Spoom::Printer

Instance Method Details

: (Snapshot snapshot) -> void



219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/spoom/coverage/snapshot.rb', line 219

def print_snapshot(snapshot)
  methods = snapshot.methods_with_sig + snapshot.methods_without_sig
  methods_excluding_rbis = snapshot.methods_with_sig_excluding_rbis + snapshot.methods_without_sig_excluding_rbis
  calls = snapshot.calls_typed + snapshot.calls_untyped

  if snapshot.version_static || snapshot.version_runtime
    printl("Sorbet static: #{snapshot.version_static}") if snapshot.version_static
    printl("Sorbet runtime: #{snapshot.version_runtime}") if snapshot.version_runtime
    printn
  end
  printl("Content:")
  indent
  printl("files: #{snapshot.files}")
  printl("files excluding rbis: #{snapshot.files - snapshot.rbi_files}")
  printl("modules: #{snapshot.modules}")
  printl("classes: #{snapshot.classes - snapshot.singleton_classes}")
  printl("methods: #{methods}")
  printl("methods excluding rbis: #{methods_excluding_rbis}")
  dedent
  printn
  printl("Sigils:")
  print_map(snapshot.sigils, snapshot.files)
  printn
  printl("Methods:")
  methods_map = {
    "with signature" => snapshot.methods_with_sig,
    "without signature" => snapshot.methods_without_sig,
  }
  print_map(methods_map, methods)
  printn
  printl("Methods excluding RBIs")
  methods_excluding_rbis_map = {
    "with signature" => snapshot.methods_with_sig_excluding_rbis,
    "without signature" => snapshot.methods_without_sig_excluding_rbis,
  }
  print_map(methods_excluding_rbis_map, methods_excluding_rbis)
  printn
  printl("Calls:")
  calls_map = {
    "typed" => snapshot.calls_typed,
    "untyped" => snapshot.calls_untyped,
  }
  print_map(calls_map, calls)
end