Method: WOoo::Electronics::IntelHexFile.read

Defined in:
lib/wo_oo/electronics/intel_hex_file.rb

.read(path) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/wo_oo/electronics/intel_hex_file.rb', line 8

def self.read(path)
  file_content = File.read(path)
  
  parser = WOoo::Electronics::IntelHexParser.new
  result = parser.parse(file_content)
  
  unless result.nil?
    hex_data = result.eval
    
    WOoo::Util::HexUtil.to_i(hex_data.scan(/../))
  else
    # TO FIX
    puts "PARSING ERROR!"
    puts parser.terminal_failures.join("\n")
    puts "----"
  end
end