Simplification

bug/bundler_fix
Lutz Wolf 2014-05-24 23:45:21 +02:00
parent 4fc6e402dc
commit fc5436417b
1 changed files with 5 additions and 9 deletions

View File

@ -514,13 +514,13 @@ module Socket
# Build ports array from port specification
pspec.split(/,/).each do |item|
target = ports
item.strip!
if item.starts_with? '!' then
negate = true
if item.start_with? '!'
item.delete! '!'
else
negate = false
target = remove
end
start, stop = item.split(/-/).map { |p| p.to_i }
@ -530,11 +530,7 @@ module Socket
start, stop = stop, start if stop < start
if negate then
start.upto(stop) { |p| remove << p }
else
start.upto(stop) { |p| ports << p }
end
start.upto(stop) { |p| target << p }
end
if ports.empty? and not remove.empty? then