Class: Spoom::Coverage::SnapshotPrinter

Inherits:
Printer
  • Object
show all
Extended by:
T::Sig
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



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/spoom/coverage/snapshot.rb', line 99

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