Class: Typ::Formatter::FormatGate::IsA

Inherits:
Formatter
  • Object
show all
Defined in:
lib/typ/formatter.rb

Instance Attribute Summary

Attributes inherited from Formatter

#gate

Instance Method Summary collapse

Methods inherited from Formatter

#actual, #head, #initialize, #to_s

Constructor Details

This class inherits a constructor from Typ::Formatter::FormatGate::Formatter

Instance Method Details

#formatObject



82
83
84
85
86
87
88
89
90
# File 'lib/typ/formatter.rb', line 82

def format
  string = "is_a #{gate.dsl_literal}"

  if gate.ok?
    Rainbow(string).green
  else
    Rainbow(string).red + "\n" + "got #{gate.it.class}".indent(2) + "\n" + gate.it.ai.indent(4)
  end
end