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
0a85dfdb
Commit
0a85dfdb
authored
May 04, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Hash instead of OrderedHash
parent
01d2fdac
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
lib/paperclip/attachment.rb
+7
-5
test/style_test.rb
+1
-1
No files found.
lib/paperclip/attachment.rb
View file @
0a85dfdb
...
@@ -161,11 +161,13 @@ module Paperclip
...
@@ -161,11 +161,13 @@ module Paperclip
end
end
def
styles
def
styles
styling_option
=
@options
[
:styles
]
if
@options
[
:styles
].
respond_to?
(
:call
)
||
@normalized_styles
.
nil?
if
styling_option
.
respond_to?
(
:call
)
||
!
@normalized_styles
styles
=
@options
[
:styles
]
@normalized_styles
=
ActiveSupport
::
OrderedHash
.
new
styles
=
styles
.
call
(
self
)
if
styles
.
respond_to?
(
:call
)
(
styling_option
.
respond_to?
(
:call
)
?
styling_option
.
call
(
self
)
:
styling_option
).
each
do
|
name
,
args
|
@normalized_styles
[
name
.
to_sym
]
=
Paperclip
::
Style
.
new
(
name
.
to_sym
,
args
.
dup
,
self
)
@normalized_styles
=
styles
.
dup
@normalized_styles
.
each_pair
do
|
name
,
options
|
@normalized_styles
[
name
.
to_sym
]
=
Paperclip
::
Style
.
new
(
name
.
to_sym
,
options
.
dup
,
self
)
end
end
end
end
@normalized_styles
@normalized_styles
...
...
test/style_test.rb
View file @
0a85dfdb
...
@@ -60,7 +60,7 @@ class StyleTest < Test::Unit::TestCase
...
@@ -60,7 +60,7 @@ class StyleTest < Test::Unit::TestCase
context
"An attachment with style rules in various forms"
do
context
"An attachment with style rules in various forms"
do
setup
do
setup
do
styles
=
ActiveSupport
::
OrderedHash
.
new
styles
=
{}
styles
[
:aslist
]
=
[
"100x100"
,
:png
]
styles
[
:aslist
]
=
[
"100x100"
,
:png
]
styles
[
:ashash
]
=
{
:geometry
=>
"100x100"
,
:format
=>
:png
}
styles
[
:ashash
]
=
{
:geometry
=>
"100x100"
,
:format
=>
:png
}
styles
[
:asstring
]
=
"100x100"
styles
[
:asstring
]
=
"100x100"
...
...
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