Permalink
Browse files

strip off spaces from container types. check not only for nil values …

…but also for empty values
  • Loading branch information...
1 parent d6c5946 commit d173ed2ad207d924bfd357fc80c85d03df7fa9c0 @jronallo committed Feb 24, 2011
Showing with 7 additions and 3 deletions.
  1. +2 −0 .gitignore
  2. +5 −3 lib/stead/ead.rb
View
@@ -13,6 +13,8 @@ tmtags
## VIM
*.swp
+.redcar
+
## PROJECT::GENERAL
coverage
rdoc
View
@@ -23,7 +23,7 @@ def pick_template(opts)
def self.from_csv(csv, opts={})
lines = csv.split(/\r\n|\n/)
100.times do
- lines[0] = lines.first.gsub(',,', ',nothing,')
+ lines[0] = lines.first.gsub(',,', ',"",')
end
csv = lines.join("\n")
self.new(opts.merge(:csv => csv))
@@ -172,9 +172,11 @@ def add_containers(cp, did)
['1', '2', '3'].each do |container_number|
container_type = cp['container ' + container_number + ' type']
container_number = cp['container ' + container_number + ' number']
- if !container_type.nil? and !container_number.nil?
+ if !container_type.nil? and !container_number.nil? and !container_type.empty? and !container_number.empty?
+ container_type.strip!
unless valid_container_type?(container_type)
- raise Stead::InvalidContainerType, container_type
+ debugger
+ raise Stead::InvalidContainerType, %Q{"#{container_type}"}
end
container = node('container')
container['type'] = container_type

0 comments on commit d173ed2

Please sign in to comment.