Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove some ternary operators in favor of ifs

  • Loading branch information...
commit 65f494188607297e62bff2f7898557e456f0bf19 1 parent 69bcf6e
@jyurek jyurek authored
Showing with 12 additions and 2 deletions.
  1. +8 −2 lib/paperclip/helpers.rb
  2. +4 −0 test/thumbnail_test.rb
View
10 lib/paperclip/helpers.rb
@@ -25,7 +25,9 @@ def interpolates key, &block
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 @@ def each_instance_with_attachment(klass, name)
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
View
4 test/thumbnail_test.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.