Class: Typ::Formatter::FormatGate::Is

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



70
71
72
73
74
75
76
77
78
# File 'lib/typ/formatter.rb', line 70

def format
  literal = gate.dsl_literal

  case literal
  when Array
    string = "is #{literal}"
    gate.ok? ? Rainbow(string).green : Rainbow(string).red
  end
end