Sha256: cd7e49b4abbb5a90798b6def6573424fac041021f2ae687fe892f4e1afe670f2
Contents?: true
Size: 1.25 KB
Versions: 5
Compression:
Stored size: 1.25 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 :exitcode attr_writer :alterations def initialize reset 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 reset @content_backup = [] @content = [] @exitcode = -1 @value = nil @expected = nil @alterations = [] end def ok? @exitcode.zero? end def restore temp = @content_backup.clone reset @content_backup = temp @content = temp.clone end alias_method :restore!, :restore def value @content[0] end end
Version data entries
5 entries across 5 versions & 1 rubygems