From f9ccad35b861e3044b7c3f85e260cd2057ce4304 Mon Sep 17 00:00:00 2001 From: bcrouse Date: Mon, 3 Feb 2014 18:13:17 -0500 Subject: [PATCH 1/2] Read options from Rails app configuration in Railtie --- lib/image_optim/railtie.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/image_optim/railtie.rb b/lib/image_optim/railtie.rb index 151a8d9d..99f28905 100644 --- a/lib/image_optim/railtie.rb +++ b/lib/image_optim/railtie.rb @@ -4,7 +4,7 @@ class ImageOptim class Railtie < Rails::Railtie initializer 'image_optim.initializer' do |app| if app.config.assets.compress && app.config.assets.image_optim != false - image_optim = ImageOptim.new + image_optim = ImageOptim.new(app.config.assets.image_optim || {}) processor = proc do |context, data| image_optim.optimize_image_data(data) || data From 7637206b65f536ff65a906fbf12f7f0044262038 Mon Sep 17 00:00:00 2001 From: bcrouse Date: Mon, 3 Feb 2014 18:20:40 -0500 Subject: [PATCH 2/2] Allow true as a valid value for app.assets.image_optim --- lib/image_optim/railtie.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/image_optim/railtie.rb b/lib/image_optim/railtie.rb index 99f28905..1cbcba95 100644 --- a/lib/image_optim/railtie.rb +++ b/lib/image_optim/railtie.rb @@ -4,7 +4,11 @@ class ImageOptim class Railtie < Rails::Railtie initializer 'image_optim.initializer' do |app| if app.config.assets.compress && app.config.assets.image_optim != false - image_optim = ImageOptim.new(app.config.assets.image_optim || {}) + image_optim = if app.config.assets.image_optim == true + ImageOptim.new + else + ImageOptim.new(app.config.assets.image_optim || {}) + end processor = proc do |context, data| image_optim.optimize_image_data(data) || data