Skip to content
Browse files

pass self into any proc assigned to a configuration attribute whenever

the proc accepts an argument
  • Loading branch information...
1 parent 50b4fe2 commit 1f817fcc52b08427dbc3f824d318fe95d6b453f7 @scottburton11 scottburton11 committed Jan 16, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/carrierwave/uploader/configuration.rb
View
6 lib/carrierwave/uploader/configuration.rb
@@ -96,7 +96,11 @@ def #{name}=(value)
def #{name}
value = @#{name} if instance_variable_defined?(:@#{name})
value = self.class.#{name} unless instance_variable_defined?(:@#{name})
- value.instance_of?(Proc) ? value.call : value
+ if value.instance_of?(Proc)
+ value.arity >= 1 ? value.call(self) : value.call
+ else
+ value
+ end
end
RUBY
end

0 comments on commit 1f817fc

Please sign in to comment.
Something went wrong with that request. Please try again.