Sha256: d4cac3dc05928aee22fa1c5ce57e09d3f523d5bbbf582918781b63270a3e6f07

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

require_relative "ext_array"
require_relative "ext_compare"
require_relative "ext_filter"

class Result
  attr_reader :content
  attr_accessor :exitcode
  attr_writer :alterations

  def initialize
    reset
  end

  def reset
    @content_backup = []
    @content = []
    @exitcode = -1

    # @value = nil
    @expected = nil
    @alterations = []
  end

  def alterations
    if @alterations.is_a? String
      @alterations
    else
      @alterations.join(" & ")
    end
  end

  def content=(content)
    @content_backup = content.clone
    @content = content.clone
  end

  def debug
    print "\n" + "*" * 20
    print " [DEBUG] count=#{@content.count} "
    puts "*" * 20
    @content.each_with_index do |item, index|
      puts format("%<index>2d: %<item>s", {index: index, item: item})
    end
    puts "*" * 57
  end

  def expected
    @expected.to_s
  end

  def ok?
    @exitcode.zero?
  end

  def restore
    temp = @content_backup.clone
    reset
    # @content_backup = temp
    # @content = temp.clone
    self.content = (temp)
  end

  def value
    @content[0]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
teuton-2.9.2 lib/teuton/case/result/result.rb
teuton-2.9.1 lib/teuton/case/result/result.rb
teuton-2.9.0 lib/teuton/case/result/result.rb