Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip
Commits
1c88a725
Commit
1c88a725
authored
Jan 27, 2012
by
Benjamin Hüttinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed is_a?(Proc) to responds_to?(:call) for better flexibility
parent
87426153
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
lib/paperclip/storage/fog.rb
+7
-5
No files found.
lib/paperclip/storage/fog.rb
View file @
1c88a725
...
...
@@ -126,7 +126,7 @@ module Paperclip
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 @@ module Paperclip
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 @@ module Paperclip
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
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment