Class: Errpt
- Inherits:
-
Object
- Object
- Errpt
- Defined in:
- lib/AIX/Errpt.rb
Instance Attribute Summary collapse
-
#data_string_raw ⇒ Object
readonly
Returns the value of attribute data_string_raw.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#errors_summary ⇒ Object
readonly
Returns the value of attribute errors_summary.
Instance Method Summary collapse
-
#initialize(string) ⇒ Errpt
constructor
A new instance of Errpt.
- #parse(string) ⇒ Object
- #summary ⇒ Object
- #summary_mark_the_same(string) ⇒ Object
Constructor Details
Instance Attribute Details
#data_string_raw ⇒ Object (readonly)
Returns the value of attribute data_string_raw.
7 8 9 |
# File 'lib/AIX/Errpt.rb', line 7 def data_string_raw @data_string_raw end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
8 9 10 |
# File 'lib/AIX/Errpt.rb', line 8 def errors @errors end |
#errors_summary ⇒ Object (readonly)
Returns the value of attribute errors_summary.
10 11 12 |
# File 'lib/AIX/Errpt.rb', line 10 def errors_summary @errors_summary end |
Instance Method Details
#parse(string) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/AIX/Errpt.rb', line 20 def parse(string) @data_string_raw = string if match = %r{LABEL:\s+([\w\_]+)\s$}.match(string) # it should be parse in different way raise 'this script can not now parse errpt -a output' else string.split("\n").each do |line| next if line =~ /^\s*IDENTIFIER\s+TIMESTAMP\s+T\s+C\s+RESOURCE_NAME\s+DESCRIPTION\s*$/ @errors.push(ErrptEntry.new(line)) end end end |
#summary ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/AIX/Errpt.rb', line 34 def summary @errors_summary = {} errors2 = @errors puts "----" @errors.each_index do |id| errpt = @errors[id] if errpt.description == 'BACK-UP PATH STATUS CHANGE' # powerpath issue end errors2.each_index {|id2| next if id == id2 errpt_tmp = @errors[id2] next if errpt_tmp._in_summary if errpt_tmp.compare_short(errpt) summary_mark_the_same(errpt_tmp.compare_short_string) end } end end |
#summary_mark_the_same(string) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/AIX/Errpt.rb', line 59 def summary_mark_the_same(string) count = 0 @errors.each_index do |id| if @errors[id].compare_short_string == string @errors[id]._in_summary = true @errors[id]._show = false count += 1 end end @errors_summary[string] = count end |