From 8ccdab41cc7407595446a71040be369a0a65bea2 Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Tue, 6 Sep 2011 15:48:10 -0400 Subject: [PATCH] refactored for cleanliness --- .../sass_extensions/sprites/layout_methods.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/compass/sass_extensions/sprites/layout_methods.rb b/lib/compass/sass_extensions/sprites/layout_methods.rb index 72eba293..d91ff85e 100644 --- a/lib/compass/sass_extensions/sprites/layout_methods.rb +++ b/lib/compass/sass_extensions/sprites/layout_methods.rb @@ -7,21 +7,25 @@ module Compass SMART = 'smart' def smart? - @kwargs.get_var('layout').value == SMART + layout == SMART end def horizontal? - @kwargs.get_var('layout').value == HORIZONTAL + layout == HORIZONTAL end def diagonal? - @kwargs.get_var('layout').value == DIAGONAL + layout == DIAGONAL + end + + def layout + @layout ||= @kwargs.get_var('layout').value end # Calculates the overal image dimensions # collects image sizes and input parameters for each sprite def compute_image_positions! - case @kwargs.get_var('layout').value + case layout when SMART calculate_smart_positions when DIAGONAL