From 2831de1c664e47568ec9bb2c6f4a2642e4aa83bd Mon Sep 17 00:00:00 2001 From: joegatt Date: Tue, 12 Mar 2013 17:07:00 +0100 Subject: [PATCH] Refactors effects helper. Testing viability of splitting out every effect to its own method. --- app/helpers/effects_helper.rb | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/app/helpers/effects_helper.rb b/app/helpers/effects_helper.rb index afd521b3..2b99b8bf 100644 --- a/app/helpers/effects_helper.rb +++ b/app/helpers/effects_helper.rb @@ -4,20 +4,34 @@ module EffectsHelper def pre_fx(image, effects) # Any effect that affects the size of the image goes here + transpose(image, effects) + transverse(image, effects) + trim(image, effects) + image + end + + def transpose(image, effects) + # Rotate left + if effects =~ /lef/ - # Rotate left image = image.transpose end + image + end + + def transverse(image, effects) + # Rotate right if effects =~ /rig/ - # Rotate right image = image.transverse end + image + end + def trim(image, effects) if effects =~ /tri/ image = image.trim end - image end