Method: Dnsruby::ZoneReader#process_file

Defined in:
lib/dnsruby/zone_reader.rb

#process_file(file) ⇒ Object

Takes a filename string and attempts to load a zone. Returns a list of RRs if successful, nil otherwise.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/dnsruby/zone_reader.rb', line 47

def process_file(file)
  line_num = 0
  zone = nil
  IO.foreach(file) { |line|
    begin

      ret = process_line(line)
      if (ret)
        rr = RR.create(ret)
        if (!zone)
          zone = []
        end
        zone.push(rr)
      end
    rescue Exception => e
      raise ParseException.new("Error reading line #{line_num} of #{file} : [#{line}]")
    end
  }
  return zone
end