Sha256: e3528467cbef7943d1db8a1c9256e44541e30993dc62cd27d9a7f1897667cb42

Contents?: true

Size: 595 Bytes

Versions: 22

Compression:

Stored size: 595 Bytes

Contents

module Compass::SassExtensions::Functions::Trig

  def pi()
    Sass::Script::Number.new(Math::PI)
  end

  def sin(number)
    trig(:sin, number)
  end

  def cos(number)
    trig(:cos, number)
  end

  def tan(number)
    trig(:tan, number)
  end
  
  private
  def trig(operation, number)
    if number.numerator_units == ["deg"] && number.denominator_units == []
      Sass::Script::Number.new(Math.send(operation, Math::PI * number.value / 360))
    else
      Sass::Script::Number.new(Math.send(operation, number.value), number.numerator_units, number.denominator_units)
    end
  end
end

Version data entries

22 entries across 22 versions & 3 rubygems

Version Path
radiant-1.0.0 ruby-debug/ruby/1.8/gems/compass-0.11.7/lib/compass/sass_extensions/functions/trig.rb
compass-0.11.7 lib/compass/sass_extensions/functions/trig.rb
compass-0.11.6 lib/compass/sass_extensions/functions/trig.rb
compass-rails31-0.12.0.alpha.0.91a748a lib/compass/sass_extensions/functions/trig.rb
compass-0.11.5 lib/compass/sass_extensions/functions/trig.rb
compass-0.11.4 lib/compass/sass_extensions/functions/trig.rb
compass-0.11.3 lib/compass/sass_extensions/functions/trig.rb
compass-0.11.2 lib/compass/sass_extensions/functions/trig.rb
compass-0.11.1 lib/compass/sass_extensions/functions/trig.rb
compass-0.11.0 lib/compass/sass_extensions/functions/trig.rb
compass-0.11.beta.7 lib/compass/sass_extensions/functions/trig.rb
compass-0.11.beta.6 lib/compass/sass_extensions/functions/trig.rb
compass-0.11.beta.5 lib/compass/sass_extensions/functions/trig.rb
compass-0.11.beta.4 lib/compass/sass_extensions/functions/trig.rb
compass-0.11.beta.3 lib/compass/sass_extensions/functions/trig.rb
compass-0.11.beta.2 lib/compass/sass_extensions/functions/trig.rb
compass-0.11.beta.1 lib/compass/sass_extensions/functions/trig.rb
compass-0.11.beta.0 lib/compass/sass_extensions/functions/trig.rb
compass-0.11.alpha.4 lib/compass/sass_extensions/functions/trig.rb
compass-0.11.alpha.3 lib/compass/sass_extensions/functions/trig.rb