Skip to content
This repository
Browse code

Remove some ternary operators in favor of ifs

  • Loading branch information...
commit 65f494188607297e62bff2f7898557e456f0bf19 1 parent 69bcf6e
Jon Yurek authored September 28, 2012
10  lib/paperclip/helpers.rb
@@ -25,7 +25,9 @@ def interpolates key, &block
25 25
     def run(cmd, arguments = "", local_options = {})
26 26
       command_path = options[:command_path]
27 27
       Cocaine::CommandLine.path = [Cocaine::CommandLine.path, command_path].flatten.compact.uniq
28  
-      local_options = local_options.merge(:logger => logger) if logging? && (options[:log_command] || local_options[:log_command])
  28
+      if logging? && (options[:log_command] || local_options[:log_command])
  29
+        local_options = local_options.merge(:logger => logger)
  30
+      end
29 31
       Cocaine::CommandLine.new(cmd, arguments, local_options).run
30 32
     end
31 33
 
@@ -39,7 +41,11 @@ def each_instance_with_attachment(klass, name)
39 41
 
40 42
     def class_for(class_name)
41 43
       class_name.split('::').inject(Object) do |klass, partial_class_name|
42  
-        klass.const_defined?(partial_class_name) ? klass.const_get(partial_class_name, false) : klass.const_missing(partial_class_name)
  44
+        if klass.const_defined?(partial_class_name)
  45
+          klass.const_get(partial_class_name, false)
  46
+        else
  47
+          klass.const_missing(partial_class_name)
  48
+        end
43 49
       end
44 50
     end
45 51
 
4  test/thumbnail_test.rb
@@ -80,6 +80,8 @@ class ThumbnailTest < Test::Unit::TestCase
80 80
       should "let us know when a command isn't found versus a processing error" do
81 81
         old_path = ENV['PATH']
82 82
         begin
  83
+          Cocaine::CommandLine.path = ''
  84
+          Paperclip.options[:command_path] = ''
83 85
           ENV['PATH'] = ''
84 86
           assert_raises(Paperclip::Errors::CommandNotFoundError) do
85 87
             silence_stream(STDERR) do
@@ -209,6 +211,8 @@ class ThumbnailTest < Test::Unit::TestCase
209 211
         should "let us know when a command isn't found versus a processing error" do
210 212
           old_path = ENV['PATH']
211 213
           begin
  214
+            Cocaine::CommandLine.path = ''
  215
+            Paperclip.options[:command_path] = ''
212 216
             ENV['PATH'] = ''
213 217
             assert_raises(Paperclip::Errors::CommandNotFoundError) do
214 218
               silence_stream(STDERR) do

0 notes on commit 65f4941

Please sign in to comment.
Something went wrong with that request. Please try again.