Class: Typ::Formatter
- Inherits:
-
Object
- Object
- Typ::Formatter
- Includes:
- FormatGate
- Defined in:
- lib/typ/formatter.rb
Defined Under Namespace
Modules: FormatGate
Instance Method Summary collapse
-
#initialize(typ) ⇒ Formatter
constructor
A new instance of Formatter.
- #to_s ⇒ Object
Methods included from FormatGate
Constructor Details
#initialize(typ) ⇒ Formatter
Returns a new instance of Formatter.
109 110 111 112 113 114 115 116 |
# File 'lib/typ/formatter.rb', line 109 def initialize typ k = typ.class @string = if typ.ok? Rainbow(k).green else Rainbow(k).red + "\n" + format_gates_of(typ).indent(2) end end |
Instance Method Details
#to_s ⇒ Object
118 119 120 |
# File 'lib/typ/formatter.rb', line 118 def to_s @string end |