Skip to content

Commit

Permalink
Refactor string escaping!
Browse files Browse the repository at this point in the history
  • Loading branch information
HamptonMakes committed Dec 28, 2011
1 parent 9ae7463 commit b2ee6d1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/mini_magick.rb
Expand Up @@ -459,7 +459,7 @@ def +(*options)
push(@args.pop.gsub(/^-/, '+'))
if options.any?
options.each do |o|
push "\"#{ o }\""
push escape_string(o)
end
end
end
Expand All @@ -468,10 +468,14 @@ def add(command, *options)
push "-#{command}"
if options.any?
options.each do |o|
push "\"#{ o }\""
push escape_string(o)
end
end
end

def escape_string(value)
'"' + value + '"'
end

def push(arg)
@args << arg.to_s.strip
Expand Down

0 comments on commit b2ee6d1

Please sign in to comment.