Class | TTK::Strategies::IOBased |
In: |
lib/ttk/strategies/IOBased.rb
|
Parent: | Strategy |
Constructor
# File lib/ttk/strategies/IOBased.rb, line 25 def initialize ( *a, &b ) stream :input stream :output stream :error super end
# File lib/ttk/strategies/IOBased.rb, line 95 def stream ( name ) @streams ||= [] @streams_name ||= [] @streams_name << name end
Accessors
# File lib/ttk/strategies/IOBased.rb, line 129 def stream_class= ( aClass ) if aClass.is_a? Class @stream_class = aClass else @stream_class = Streams.const_get(aClass) end end
# File lib/ttk/strategies/IOBased.rb, line 45 def assertion @streams.each do |stream| next if invalid_stream?(stream) fail("#{stream.name} is different") unless stream.compare_streams end pass end
# File lib/ttk/strategies/IOBased.rb, line 55 def epilogue @streams.each { |strm| strm.clean unless strm.nil? } super end
# File lib/ttk/strategies/IOBased.rb, line 69 def failed_hook super @streams.each do |stream| next if invalid_stream?(stream) @log["#{stream.name}_status"] = stream.status end print_streams() unless @quiet_print end
# File lib/ttk/strategies/IOBased.rb, line 102 def make_streams @streams = @streams_name.map do |name| stream = nil if instance_variables.include? "@#{name}" val = instance_variable_get("@#{name}") if val.nil? stream = @stream_class.new(name) else val = val.do_symtbl_gsub(@symtbl) if val.is_a? String tmp = TempPath.new tmp.open('w') { |res| res.print val } val = tmp.open('r') end stream = @stream_class.new(name, val) end end instance_variable_set "@#{name}", stream stream end end
# File lib/ttk/strategies/IOBased.rb, line 62 def pass_hook super print_streams() if @verbose_print end