Commit 0a85dfdb by Prem Sichanugrist

Use Hash instead of OrderedHash

parent 01d2fdac
......@@ -161,11 +161,13 @@ module Paperclip
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
......
......@@ -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"
......
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