Class: Typ::Formatter

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

Instance Method Summary collapse

Constructor Details

#initialize(typ) ⇒ Formatter

Returns a new instance of Formatter.



5
6
7
8
9
10
11
12
# File 'lib/typ/formatter.rb', line 5

def initialize typ
  name = typ.class.name
  @string = if typ.ok?
              Rainbow(name).green
            else
              Rainbow(name).red + "\n" + format_gates_of(typ)
            end
end

Instance Method Details

#to_sObject



14
15
16
# File 'lib/typ/formatter.rb', line 14

def to_s
  @string
end