Sha256: 94c2c5eacd8ee4264980b1e2478bf8e281c85c7cd1c4b87e81a2a1967da6510a

Contents?: true

Size: 1.2 KB

Versions: 14

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

require_relative 'ext_array'
require_relative 'ext_compare'
require_relative 'ext_filter'

# This object contains data returned by remote/local execution
# * initialize
# * alterations
# * content
# * debug
# * ok?
# * reset
# * restore
# * value
class Result
  attr_reader :content
  attr_accessor :exitstatus

  def initialize
    reset
  end

  def alterations
    @alterations.join(' & ')
  end

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

  def reset
    @content_backup = []
    @content        = []
    @exitstatus     = nil
    @value          = nil
    @expected       = nil
    @alterations    = []
  end

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

  def expected
    @expected.to_s
  end

  def ok?
    return false if @exitstatus.nil?

    @exitstatus.zero?
  end

  def restore
    temp = @content_backup.clone
    reset
    @content_backup = temp
    @content        = temp.clone
  end
  alias restore! restore

  def value
    @content[0]
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
teuton-2.1.11 lib/teuton/case_manager/case/result/result.rb
teuton-2.1.10 lib/teuton/case_manager/case/result/result.rb
teuton-2.1.9 lib/teuton/case_manager/case/result/result.rb
teuton-2.1.8 lib/teuton/case_manager/case/result/result.rb
teuton-2.1.8dev1 lib/teuton/case_manager/case/result/result.rb
teuton-2.1.7 lib/teuton/case_manager/case/result/result.rb
teuton-2.1.6 lib/teuton/case_manager/case/result/result.rb
teuton-2.1.5dev lib/teuton/case_manager/case/result/result.rb
teuton-2.1.4 lib/teuton/case_manager/case/result/result.rb
teuton-2.1.3 lib/teuton/case_manager/case/result/result.rb
teuton-2.1.2 lib/teuton/case_manager/case/result/result.rb
teuton-2.1.1 lib/teuton/case_manager/case/result/result.rb
teuton-2.1.0 lib/teuton/case_manager/case/result/result.rb
teuton-0.0.1 lib/teuton/case_manager/case/result/result.rb