lib/carrierwave/sanitized_file.rb in carrierwave-1.3.1 vs lib/carrierwave/sanitized_file.rb in carrierwave-1.3.2
- old
+ new
@@ -112,16 +112,15 @@
# === Returns
#
# [String, nil] the path where the file is located.
#
def path
- unless @file.blank?
- if is_path?
- File.expand_path(@file)
- elsif @file.respond_to?(:path) and not @file.path.blank?
- File.expand_path(@file.path)
- end
+ return if @file.blank?
+ if is_path?
+ File.expand_path(@file)
+ elsif @file.respond_to?(:path) && !@file.path.blank?
+ File.expand_path(@file.path)
end
end
##
# === Returns
@@ -311,10 +310,10 @@
# create the directory if it doesn't exist
def mkdir!(path, directory_permissions)
options = {}
options[:mode] = directory_permissions if directory_permissions
- FileUtils.mkdir_p(File.dirname(path), options) unless File.exist?(File.dirname(path))
+ FileUtils.mkdir_p(File.dirname(path), **options) unless File.exist?(File.dirname(path))
end
def chmod!(path, permissions)
File.chmod(permissions, path) if permissions
end