Sha256: 302d8ab98e156a701c2866b87011ced5d66f52c65f8ebf8d1199079996158ae9

Contents?: true

Size: 1.56 KB

Versions: 2

Compression:

Stored size: 1.56 KB

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bspin-1.0.1 app/helpers/bspin_helper.rb
bspin-1.0.0 app/helpers/bspin_helper.rb