Commit 0a85dfdb by Prem Sichanugrist

Use Hash instead of OrderedHash

parent 01d2fdac
...@@ -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
......
...@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment