51: def self.to_line(hash)
52: return super unless hash[:record_type] == :parsed
53: [:ip, :name].each do |n|
54: unless hash[n] and hash[n] != :absent
55: raise ArgumentError, "%s is a required attribute for hosts" % n
56: end
57: end
58:
59: str = "%s\t%s" % [hash[:ip], hash[:name]]
60:
61: if hash.include? :alias
62: if hash[:alias].is_a? Array
63: str += "\t%s" % hash[:alias].join("\t")
64: else
65: raise ArgumentError, "Aliases must be specified as an array"
66: end
67: end
68:
69: str
70: end