Permalink
Browse files

Use Hash instead of OrderedHash

  • Loading branch information...
1 parent 01d2fda commit 0a85dfdb0c185312e9dc17d21f603ce1fe8334f4 @sikachu sikachu committed May 4, 2012
Showing with 8 additions and 6 deletions.
  1. +7 −5 lib/paperclip/attachment.rb
  2. +1 −1 test/style_test.rb
View
12 lib/paperclip/attachment.rb
@@ -161,11 +161,13 @@ def default_style
end
def styles
- styling_option = @options[:styles]
- if styling_option.respond_to?(:call) || !@normalized_styles
- @normalized_styles = ActiveSupport::OrderedHash.new
- (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)
+ if @options[:styles].respond_to?(:call) || @normalized_styles.nil?
+ styles = @options[:styles]
+ styles = styles.call(self) if styles.respond_to?(:call)
+
+ @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
@normalized_styles
View
2 test/style_test.rb
@@ -60,7 +60,7 @@ class StyleTest < Test::Unit::TestCase
context "An attachment with style rules in various forms" do
setup do
- styles = ActiveSupport::OrderedHash.new
+ styles = {}
styles[:aslist] = ["100x100", :png]
styles[:ashash] = {:geometry => "100x100", :format => :png}
styles[:asstring] = "100x100"

0 comments on commit 0a85dfd

Please sign in to comment.