Commit 65f49418 by Jon Yurek

Remove some ternary operators in favor of ifs

parent 69bcf6e4
......@@ -25,7 +25,9 @@ module Paperclip
def run(cmd, arguments = "", local_options = {})
command_path = options[:command_path]
Cocaine::CommandLine.path = [Cocaine::CommandLine.path, command_path].flatten.compact.uniq
local_options = local_options.merge(:logger => logger) if logging? && (options[:log_command] || local_options[:log_command])
if logging? && (options[:log_command] || local_options[:log_command])
local_options = local_options.merge(:logger => logger)
end
Cocaine::CommandLine.new(cmd, arguments, local_options).run
end
......@@ -39,7 +41,11 @@ module Paperclip
def class_for(class_name)
class_name.split('::').inject(Object) do |klass, partial_class_name|
klass.const_defined?(partial_class_name) ? klass.const_get(partial_class_name, false) : klass.const_missing(partial_class_name)
if klass.const_defined?(partial_class_name)
klass.const_get(partial_class_name, false)
else
klass.const_missing(partial_class_name)
end
end
end
......
......@@ -80,6 +80,8 @@ class ThumbnailTest < Test::Unit::TestCase
should "let us know when a command isn't found versus a processing error" do
old_path = ENV['PATH']
begin
Cocaine::CommandLine.path = ''
Paperclip.options[:command_path] = ''
ENV['PATH'] = ''
assert_raises(Paperclip::Errors::CommandNotFoundError) do
silence_stream(STDERR) do
......@@ -209,6 +211,8 @@ class ThumbnailTest < Test::Unit::TestCase
should "let us know when a command isn't found versus a processing error" do
old_path = ENV['PATH']
begin
Cocaine::CommandLine.path = ''
Paperclip.options[:command_path] = ''
ENV['PATH'] = ''
assert_raises(Paperclip::Errors::CommandNotFoundError) do
silence_stream(STDERR) do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment