Class: Uttk::Streams::Stream

Inherits:
Object
  • Object
show all
Defined in:
lib/uttk/streams/Stream.rb

Direct Known Subclasses

Diff

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, ref = nil) ⇒ Stream

Constructor



24
25
26
# File 'lib/uttk/streams/Stream.rb', line 24

def initialize ( name, ref=nil )
  @name, @my, @ref = name.to_s, TempPath.new(name), ref
end

Instance Attribute Details

#myObject

Attributes



17
18
19
# File 'lib/uttk/streams/Stream.rb', line 17

def my
  @my
end

#nameObject

Attributes



17
18
19
# File 'lib/uttk/streams/Stream.rb', line 17

def name
  @name
end

#refObject

Attributes



17
18
19
# File 'lib/uttk/streams/Stream.rb', line 17

def ref
  @ref
end

Instance Method Details

#cleanObject



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/uttk/streams/Stream.rb', line 60

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

#compare_streamsObject

Methods



33
34
35
36
37
38
# File 'lib/uttk/streams/Stream.rb', line 33

def compare_streams
  return @cmp if defined? @cmp
  @cmp = @ref.compare_stream(@my)
  @status = @cmp ? :PASS : :FAILED
  @cmp
end

#statusObject



40
41
42
43
# File 'lib/uttk/streams/Stream.rb', line 40

def status
  compare_streams
  @status
end

#to_uttk_log(log) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/uttk/streams/Stream.rb', line 45

def to_uttk_log ( log )
  unless @name == 'input'
    str = @my.to_s_for_uttk_log
    unless str.nil? or (str.is_a? String and str.empty?)
      log["my_#@name"] = str
    end
  end
  unless @ref.nil?
    str = @ref.to_s_for_uttk_log
    unless str.nil? or (str.is_a? String and str.empty?)
      log["ref_#@name"] = str
    end
  end
end