Class: Typ::Formatter
- Inherits:
-
Object
- Object
- Typ::Formatter
- Defined in:
- lib/typ/formatter.rb
Instance Method Summary collapse
-
#initialize(typ) ⇒ Formatter
constructor
A new instance of Formatter.
- #to_s ⇒ Object
Constructor Details
#initialize(typ) ⇒ Formatter
Returns a new instance of Formatter.
6 7 8 9 10 11 12 13 |
# File 'lib/typ/formatter.rb', line 6 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
15 16 17 |
# File 'lib/typ/formatter.rb', line 15 def to_s @string end |