sassy-math 1.1 → 1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/sassy-math.rb +2 -19
 - data/sassy-math.gemspec +2 -3
 - metadata +3 -17
 
    
        data/lib/sassy-math.rb
    CHANGED
    
    | 
         @@ -1,25 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'compass'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'fraction'
         
     | 
| 
       3 
2 
     | 
    
         
             
            Compass::Frameworks.register("sassy-math", :path => "#{File.dirname(__FILE__)}/..")
         
     | 
| 
       4 
3 
     | 
    
         | 
| 
       5 
4 
     | 
    
         
             
            # Sassy math Functions
         
     | 
| 
       6 
5 
     | 
    
         
             
            module Sass::Script::Functions
         
     | 
| 
       7 
     | 
    
         
            -
              # Fractions
         
     | 
| 
       8 
     | 
    
         
            -
              def numerator(number)
         
     | 
| 
       9 
     | 
    
         
            -
                Sass::Script::Number.new(number.value.fraction.first)
         
     | 
| 
       10 
     | 
    
         
            -
              end
         
     | 
| 
       11 
     | 
    
         
            -
              def denominator(number)
         
     | 
| 
       12 
     | 
    
         
            -
                num, den = number.value.fraction
         
     | 
| 
       13 
     | 
    
         
            -
                Sass::Script::Number.new(den)
         
     | 
| 
       14 
     | 
    
         
            -
              end
         
     | 
| 
       15 
     | 
    
         
            -
              def to_fraction(number)
         
     | 
| 
       16 
     | 
    
         
            -
                result = numerator(number).to_s + '/' + denominator(number).to_s
         
     | 
| 
       17 
     | 
    
         
            -
                Sass::Script::String.new(result)
         
     | 
| 
       18 
     | 
    
         
            -
              end
         
     | 
| 
       19 
     | 
    
         
            -
              def to_decimal(fraction)
         
     | 
| 
       20 
     | 
    
         
            -
                fraction = fraction.value.to_f
         
     | 
| 
       21 
     | 
    
         
            -
                Sass::Script::Number.new(fraction)
         
     | 
| 
       22 
     | 
    
         
            -
              end
         
     | 
| 
       23 
6 
     | 
    
         
             
              # Exponents
         
     | 
| 
       24 
7 
     | 
    
         
             
              def exponent(base, powerNum, powerDen)
         
     | 
| 
       25 
8 
     | 
    
         
             
                base = base.value.to_f
         
     | 
| 
         @@ -170,7 +153,7 @@ end 
     | 
|
| 
       170 
153 
     | 
    
         | 
| 
       171 
154 
     | 
    
         
             
            module SassyMath
         
     | 
| 
       172 
155 
     | 
    
         | 
| 
       173 
     | 
    
         
            -
              VERSION = "1. 
     | 
| 
       174 
     | 
    
         
            -
              DATE = "2012- 
     | 
| 
      
 156 
     | 
    
         
            +
              VERSION = "1.2"
         
     | 
| 
      
 157 
     | 
    
         
            +
              DATE = "2012-07-29"
         
     | 
| 
       175 
158 
     | 
    
         | 
| 
       176 
159 
     | 
    
         
             
            end
         
     | 
    
        data/sassy-math.gemspec
    CHANGED
    
    | 
         @@ -2,11 +2,11 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       4 
4 
     | 
    
         
             
              s.name = %q{sassy-math}
         
     | 
| 
       5 
     | 
    
         
            -
              s.version = "1. 
     | 
| 
      
 5 
     | 
    
         
            +
              s.version = "1.2"
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
              s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5")
         
     | 
| 
       8 
8 
     | 
    
         
             
              s.authors = ["Sam Richard", "Mario Valencia", "Scott Kellum"]
         
     | 
| 
       9 
     | 
    
         
            -
              s.date = %q{2012- 
     | 
| 
      
 9 
     | 
    
         
            +
              s.date = %q{2012-07-29}
         
     | 
| 
       10 
10 
     | 
    
         
             
              s.description = %q{Use advanced mathematical functions in Compass.}
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.email = %w{snugug@gmail.com}
         
     | 
| 
       12 
12 
     | 
    
         
             
              s.has_rdoc = false
         
     | 
| 
         @@ -21,5 +21,4 @@ Gem::Specification.new do |s| 
     | 
|
| 
       21 
21 
     | 
    
         
             
              s.rubygems_version = %q{1.3.6}
         
     | 
| 
       22 
22 
     | 
    
         
             
              s.summary = %q{Advanced math functions for Compass.}
         
     | 
| 
       23 
23 
     | 
    
         
             
              s.add_dependency(%q<compass>, ["~> 0.11"])
         
     | 
| 
       24 
     | 
    
         
            -
              s.add_dependency("fraction",  [">=0.3.2"])
         
     | 
| 
       25 
24 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -4,8 +4,8 @@ version: !ruby/object:Gem::Version 
     | 
|
| 
       4 
4 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       5 
5 
     | 
    
         
             
              segments: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              - 1
         
     | 
| 
       7 
     | 
    
         
            -
              -  
     | 
| 
       8 
     | 
    
         
            -
              version: "1. 
     | 
| 
      
 7 
     | 
    
         
            +
              - 2
         
     | 
| 
      
 8 
     | 
    
         
            +
              version: "1.2"
         
     | 
| 
       9 
9 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       10 
10 
     | 
    
         
             
            authors: 
         
     | 
| 
       11 
11 
     | 
    
         
             
            - Sam Richard
         
     | 
| 
         @@ -15,7 +15,7 @@ autorequire: 
     | 
|
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date: 2012- 
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2012-07-29 00:00:00 -04:00
         
     | 
| 
       19 
19 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       20 
20 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       21 
21 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -31,20 +31,6 @@ dependencies: 
     | 
|
| 
       31 
31 
     | 
    
         
             
                    version: "0.11"
         
     | 
| 
       32 
32 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       33 
33 
     | 
    
         
             
              version_requirements: *id001
         
     | 
| 
       34 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       35 
     | 
    
         
            -
              name: fraction
         
     | 
| 
       36 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       37 
     | 
    
         
            -
              requirement: &id002 !ruby/object:Gem::Requirement 
         
     | 
| 
       38 
     | 
    
         
            -
                requirements: 
         
     | 
| 
       39 
     | 
    
         
            -
                - - ">="
         
     | 
| 
       40 
     | 
    
         
            -
                  - !ruby/object:Gem::Version 
         
     | 
| 
       41 
     | 
    
         
            -
                    segments: 
         
     | 
| 
       42 
     | 
    
         
            -
                    - 0
         
     | 
| 
       43 
     | 
    
         
            -
                    - 3
         
     | 
| 
       44 
     | 
    
         
            -
                    - 2
         
     | 
| 
       45 
     | 
    
         
            -
                    version: 0.3.2
         
     | 
| 
       46 
     | 
    
         
            -
              type: :runtime
         
     | 
| 
       47 
     | 
    
         
            -
              version_requirements: *id002
         
     | 
| 
       48 
34 
     | 
    
         
             
            description: Use advanced mathematical functions in Compass.
         
     | 
| 
       49 
35 
     | 
    
         
             
            email: 
         
     | 
| 
       50 
36 
     | 
    
         
             
            - snugug@gmail.com
         
     |