1. merritt
  2. Untitled project
  3. mrt-ingest-ruby

Commits

Erik Hetzner  committed 0a1f79a

write erc: at beginning of erc file

  • Participants
  • Parent commits ceee2d8
  • Branches default

Comments (0)

Files changed (2)

File lib/mrt/ingest/iobject.rb

View file
                           Component.new(@server, @erc, :name => 'mrt-erc.txt')
                         when Hash
                           uri_str, path = @server.add_file do |f|
+                            f.write("erc:\n")
                             @erc.each_pair do |k, v|
                               f.write("#{k}: #{v}\n")
                             end

File test/test_iobject.rb

View file
   end
 
   def parse_erc(erc)
-    return Hash[erc.map { |l| l.chomp.split(/:\s+/) }]
+    arr = erc.map do |line|
+      md = line.chomp.match(/^([^:]+):\s*(.*)$/)
+      [md[1], md[2]]
+    end.flatten
+    h = Hash[*arr]
+    h.delete("erc")
+    return h
   end
 
   def parse_erc_entry(erc_entry)