# File lib/puppet/util/fileparsing.rb, line 144
144:   def handle_record_line(line, record)
145:     ret = nil
146:     if record.respond_to?(:process)
147:       if ret = record.send(:process, line.dup)
148:         unless ret.is_a?(Hash)
149:           raise Puppet::DevError,
150:             "Process record type #{record.name} returned non-hash"
151:         end
152:       else
153:         return nil
154:       end
155:     elsif regex = record.match
156:       # In this case, we try to match the whole line and then use the
157:       # match captures to get our fields.
158:       if match = regex.match(line)
159:         fields = []
160:         ret = {}
161:         record.fields.zip(match.captures).each do |field, value|
162:           if value == record.absent
163:             ret[field] = :absent
164:           else
165:             ret[field] = value
166:           end
167:         end
168:       else
169:         nil
170:       end
171:     else
172:       ret = {}
173:       sep = record.separator
174: 
175:       # String "helpfully" replaces ' ' with /\s+/ in splitting, so we
176:       # have to work around it.
177:       if sep == " "
178:         sep = / /
179:       end
180:       line_fields = line.split(sep)
181:       record.fields.each do |param|
182:         value = line_fields.shift
183:         if value and value != record.absent
184:           ret[param] = value
185:         else
186:           ret[param] = :absent
187:         end
188:       end
189: 
190:       if record.rollup and ! line_fields.empty?
191:         last_field = record.fields[-1]
192:         val = ([ret[last_field]] + line_fields).join(record.joiner)
193:         ret[last_field] = val
194:       end
195:     end
196: 
197:     if ret
198:       ret[:record_type] = record.name
199:       return ret
200:     else
201:       return nil
202:     end
203:   end