Method: EnergyPlus::EpErrFile#parse

Defined in:
lib/energyplus/EpErrFile.rb

#parse(id, text) ⇒ Object

work horse



102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/energyplus/EpErrFile.rb', line 102

def parse(id, text)
  storage = []
  this_text = text
  # match first id label and continue matching across lines while seeing the continue label "**   ~~~   **"
  regex = /\*\*\s*#{id}\s*\*\*.*?\n(\s+\*\*\s\s\s~~~\s\s\s\*\*.*?\n)*/m
  while match_data = this_text.match(regex)
    this_string = match_data.to_s.gsub(/.*\*\*\s*#{id}\s*\*\*/, '').gsub(/.*\*\*\s\s\s~~~\s\s\s\*\*/, '').gsub(/\s*\n/, "\n")
    storage.push(this_string)
    this_text = match_data.post_match
  end
  return storage.uniq
end