lib/joint.rb in joint-0.5.3 vs lib/joint.rb in joint-0.5.4

- old
+ new

@@ -24,14 +24,21 @@ File.size(file) end end def self.type(file) - if file.respond_to?(:content_type) - file.content_type - else - Wand.wave(file.path, :original_filename => Joint.name(file)) + type = file.content_type if file.respond_to?(:content_type) + + if blank?(type) + type = Wand.wave(file.path, :original_filename => Joint.name(file)) end + + type + end + +private + def self.blank?(str) + str.nil? || str !~ /\S/ end end require 'joint/class_methods' require 'joint/instance_methods'