Skip to content

Commit

Permalink
strip off spaces from container types. check not only for nil values …
Browse files Browse the repository at this point in the history
…but also for empty values
  • Loading branch information
jronallo committed Feb 24, 2011
1 parent d6c5946 commit d173ed2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -13,6 +13,8 @@ tmtags
## VIM
*.swp

.redcar

## PROJECT::GENERAL
coverage
rdoc
Expand Down
8 changes: 5 additions & 3 deletions lib/stead/ead.rb
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d173ed2

Please sign in to comment.