Class: BaseChip::OutFile
- Inherits:
-
Object
- Object
- BaseChip::OutFile
- Includes:
- Base, Dsl, TrackState
- Defined in:
- lib/base_chip/out_file.rb
Instance Attribute Summary collapse
-
#totals ⇒ Object
Returns the value of attribute totals.
Attributes included from Dsl
Instance Method Summary collapse
-
#go(name) ⇒ Object
def find_parent_values super @warning_regex = to_regex(@warning_regex) if @warning_regex @error_regex = to_regex(@error_regex ) if @error_regex @pass_regex = to_regex(@pass_regex ) if @pass_regex end.
-
#initialize ⇒ OutFile
constructor
A new instance of OutFile.
Methods included from TrackState
Methods included from Base
Methods included from Dsl
#add_child_mode_as_child, included, #inherit, #mode, #mode?, #type_plural
Constructor Details
#initialize ⇒ OutFile
Returns a new instance of OutFile.
33 34 35 36 |
# File 'lib/base_chip/out_file.rb', line 33 def initialize super @totals = {} end |
Instance Attribute Details
#totals ⇒ Object
Returns the value of attribute totals.
31 32 33 |
# File 'lib/base_chip/out_file.rb', line 31 def totals @totals end |
Instance Method Details
#go(name) ⇒ Object
def find_parent_values
super
@warning_regex = to_regex(@warning_regex) if @warning_regex
@error_regex = to_regex(@error_regex ) if @error_regex
@pass_regex = to_regex(@pass_regex ) if @pass_regex
end
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/base_chip/out_file.rb', line 43 def go(name) sleep(@file_delay || 0) files = Dir.glob(@name.to_s) error!(@name,"Could not find any files matching #{@name}") unless files[0] || @optional # FIXME fault if file doesn't exist files.each do |fname| f = File.open(fname,'r') f.each do |l| if @warning_regex && (match = @warning_regex.match(l)); warning!(fname,match.to_s) end if @error_regex && (match = @error_regex .match(l)); error!( fname,match.to_s) end if @pass_regex && (match = @pass_regex .match(l)); pass! end if @statistics @statistics.each_value do |s| fault("statistic '#{s.full_name}' has no regex defined") unless s.regex if match = s.regex.match(l); @totals[s.name] = (match[1] && match[1].to_i) || 1 end end end end if @pass_regex && @state.nil? error!(fname,"passing banner /#{@pass_regex}/ could not be found") end end end |