module BspinHelper def styling(options = {}) options[:colour] ||= 'black' if options[:type] == "ball" sizing = "1" else sizing = "2" end case options[:size] when "small" sizing == "1" ? options[:size] = 30 : options[:size] = 5 when "medium" sizing == "1" ? options[:size] = 50 : options[:size] = 11 when "large" sizing == "1" ? options[:size] = 90 : options[:size] = 18 when "x-large" sizing == "1" ? options[:size] = 120 : options[:size] = 25 else sizing == "1" ? options[:size] = 90 : options[:size] = 18 end case options[:speed] when "slow" options[:speed] = 3.0 when "regular" options[:speed] = 1.7 when "fast" options[:speed] = 0.5 else options[:speed] = 1.7 end case options[:type] when "ball" spin_type = "ball" when "circle1" spin_type = "circle1" when "circle1-fade" spin_type = "circle1-fade" when "circle2" spin_type = "circle2" when "bubble1" spin_type = "bubble1" when "bubble2" spin_type = "bubble2" when "bar1" spin_type = "bar1" when "bar2" spin_type = "bar2" else spin_type = "ball" end render partial: 'bspin/bspin', locals: { colour: options[:colour], size: options[:size], speed: options[:speed], spin_type: spin_type} end end