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
600ef087
Commit
600ef087
authored
Oct 05, 2011
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the setter detection in Options more robust
parent
bde480d1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletions
+8
-1
lib/paperclip/options.rb
+1
-1
test/options_test.rb
+7
-0
No files found.
lib/paperclip/options.rb
View file @
600ef087
...
@@ -54,7 +54,7 @@ module Paperclip
...
@@ -54,7 +54,7 @@ module Paperclip
end
end
def
method_missing
(
method
,
*
args
,
&
blk
)
def
method_missing
(
method
,
*
args
,
&
blk
)
if
method
.
to_s
[
-
1
]
==
"="
if
method
.
to_s
[
-
1
,
1
]
==
"="
instance_variable_set
(
"@
#{
method
[
0
..-
2
]
}
"
,
args
[
0
])
instance_variable_set
(
"@
#{
method
[
0
..-
2
]
}
"
,
args
[
0
])
else
else
instance_variable_get
(
"@
#{
method
}
"
)
instance_variable_get
(
"@
#{
method
}
"
)
...
...
test/options_test.rb
View file @
600ef087
...
@@ -8,6 +8,13 @@ class MockAttachment < Struct.new(:one, :two)
...
@@ -8,6 +8,13 @@ class MockAttachment < Struct.new(:one, :two)
end
end
class
OptionsTest
<
Test
::
Unit
::
TestCase
class
OptionsTest
<
Test
::
Unit
::
TestCase
should
"be able to set a value"
do
@options
=
Paperclip
::
Options
.
new
(
nil
,
{})
assert_nil
@options
.
path
@options
.
path
=
"this/is/a/path"
assert_equal
"this/is/a/path"
,
@options
.
path
end
context
"#styles with a plain hash"
do
context
"#styles with a plain hash"
do
setup
do
setup
do
@attachment
=
MockAttachment
.
new
(
nil
,
nil
)
@attachment
=
MockAttachment
.
new
(
nil
,
nil
)
...
...
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