Class: PactBroker::Api::Decorators::MatrixTextDecorator

Inherits:
Object
  • Object
show all
Defined in:
lib/pact_broker/api/decorators/matrix_text_decorator.rb

Defined Under Namespace

Classes: Line

Instance Method Summary collapse

Constructor Details

#initialize(lines) ⇒ MatrixTextDecorator

Returns a new instance of MatrixTextDecorator.



13
14
15
# File 'lib/pact_broker/api/decorators/matrix_text_decorator.rb', line 13

def initialize(lines)
  @lines = lines
end

Instance Method Details

#to_text(**_options) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/pact_broker/api/decorators/matrix_text_decorator.rb', line 17

def to_text(**_options)
  json_decorator = PactBroker::Api::Decorators::MatrixDecorator.new(lines)
  data = lines.collect do | line |
    Line.new(line.consumer_name, line.consumer_version_number, line.pact_revision_number, line.provider_name, line.provider_version_number, line.verification_number, line.success)
  end
  printer = TablePrint::Printer.new(data)
  printer.table_print + "\n\nDeployable: #{json_decorator.deployable.inspect}\nReason: #{json_decorator.reason}\n"
end