# Author:: Nicolas Pouillard . # Copyright:: Copyright (c) 2004, 2005 TTK team. All rights reserved. # License:: LGPL # $Id: Stream.rb 602 2005-06-03 16:11:12Z ertai $ module TTK module Streams class Stream # # Attributes # attr_accessor :name, :my, :ref # # Constructor # def initialize ( name, ref=nil ) @name, @my, @ref = name.to_s, TempPath.new(name), ref end # # Methods # def compare_streams return @cmp if defined? @cmp @cmp = @ref.compare_stream(@my) @status = @cmp ? :PASS : :FAILED @cmp end def status compare_streams @status end def to_ttk_log ( log ) log["my_#@name"] = @my.to_s_for_ttk_log log["ref_#@name"] = @ref.to_s_for_ttk_log unless @ref.nil? end def clean if @my.is_a? Pathname @my.unlink if @my.exist? and @my.temp? end if @ref.is_a? Pathname @ref.unlink if @ref.exist? and @ref.temp? elsif @ref.is_a? File ref = Pathname.new(@ref.path) ref.unlink if ref.exist? and ref.temp? end end end # class Stream end # module Streams end # module TTK