Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changed is_a?(Proc) to responds_to?(:call) for better flexibility

  • Loading branch information...
commit 1c88a72519ddd4566a628457489c6e4e5872ea06 1 parent 8742615
@maxigs maxigs authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 lib/paperclip/storage/fog.rb
View
12 lib/paperclip/storage/fog.rb
@@ -126,7 +126,7 @@ def to_file(style = default_style)
def public_url(style = default_style)
if @options[:fog_host]
- host = if @options[:fog_host].is_a?(Proc)
+ host = if @options[:fog_host].respond_to?(:call)
@options[:fog_host].call(self)
else
(@options[:fog_host] =~ /%d/) ? @options[:fog_host] % (path(style).hash % 4) : @options[:fog_host]
@@ -163,10 +163,12 @@ def find_credentials(creds)
YAML::load(ERB.new(File.read(creds)).result)
when Hash
creds
- when Proc
- creds.call(self)
else
- raise ArgumentError, "Credentials are not a path, file, hash or proc."
+ if creds.respond_to?(:call)
+ creds.call(self)
+ else
+ raise ArgumentError, "Credentials are not a path, file, hash or proc."
+ end
end
end
@@ -175,7 +177,7 @@ def connection
end
def directory
- dir = if @options[:fog_directory].is_a?(Proc)
+ dir = if @options[:fog_directory].respond_to?(:call)
@options[:fog_directory].call(self)
else
@options[:fog_directory]
Please sign in to comment.
Something went wrong with that request. Please try again.