sy 2.1.4 → 2.1.5
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.
- checksums.yaml +4 -4
 - data/lib/sy/matrix.rb +9 -0
 - data/lib/sy/quantity.rb +3 -2
 - data/lib/sy/unit.rb +2 -2
 - data/lib/sy/version.rb +1 -1
 - data/sy.gemspec +2 -0
 - data/test/sy_test.rb +0 -1
 - metadata +16 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 9f19be8e030d6377ea6aa6ca7b63ea7d4a9f75d3
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 2aff716401174198bdb2b8818c30c51804ec1fa8
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: ed78358832fc839cf646ab5cf269c8353dda7b55ce8cfb2486ad3d0d16135e5baa68d60447e4bcb077da838ab69459d3ac6f56a2411cac685ad86ad1206e9bc1
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 2256ba70404f56dc4d509e78727d2343028292de4934b4f964743ab8345b0cbf6db21701c7a2c3442bccec68b44c3d0d8d6da9bc724089a145916c0dfa135a1c
         
     | 
    
        data/lib/sy/matrix.rb
    CHANGED
    
    | 
         @@ -2,6 +2,15 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'matrix'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
      
 5 
     | 
    
         
            +
            class << WILDCARD_ZERO = Object.new
         
     | 
| 
      
 6 
     | 
    
         
            +
              def + other; other end
         
     | 
| 
      
 7 
     | 
    
         
            +
              def - other; -other end
         
     | 
| 
      
 8 
     | 
    
         
            +
              def * other; self end
         
     | 
| 
      
 9 
     | 
    
         
            +
              def / other; self end
         
     | 
| 
      
 10 
     | 
    
         
            +
              def ** exp; self end
         
     | 
| 
      
 11 
     | 
    
         
            +
              def coerce other; return self, other end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
       5 
14 
     | 
    
         
             
            # As a matter of fact, current version of the Matrix class (by Marc-Andre
         
     | 
| 
       6 
15 
     | 
    
         
             
            # Lafortune) does not work with physical magnitudes. It is a feature of the
         
     | 
| 
       7 
16 
     | 
    
         
             
            # physical magnitudes, that they do not allow themselves summed with plain
         
     | 
    
        data/lib/sy/quantity.rb
    CHANGED
    
    | 
         @@ -255,8 +255,9 @@ class SY::Quantity 
     | 
|
| 
       255 
255 
     | 
    
         
             
              # Constructs a new unit of this quantity.
         
     | 
| 
       256 
256 
     | 
    
         
             
              # 
         
     | 
| 
       257 
257 
     | 
    
         
             
              def unit **nn
         
     | 
| 
       258 
     | 
    
         
            -
                Unit().new( nn.update( of: self ) )
         
     | 
| 
       259 
     | 
    
         
            -
             
     | 
| 
      
 258 
     | 
    
         
            +
                u = Unit().new( nn.update( of: self ) )
         
     | 
| 
      
 259 
     | 
    
         
            +
                ( units << u ).uniq! # Add it to @units array.
         
     | 
| 
      
 260 
     | 
    
         
            +
                return u
         
     | 
| 
       260 
261 
     | 
    
         
             
              end
         
     | 
| 
       261 
262 
     | 
    
         | 
| 
       262 
263 
     | 
    
         
             
              # Constructor of a new standard unit (replacing current @standard_unit).
         
     | 
    
        data/lib/sy/unit.rb
    CHANGED
    
    | 
         @@ -11,8 +11,8 @@ module SY::Unit 
     | 
|
| 
       11 
11 
     | 
    
         
             
                # 
         
     | 
| 
       12 
12 
     | 
    
         
             
                def instance arg
         
     | 
| 
       13 
13 
     | 
    
         
             
                  begin
         
     | 
| 
       14 
     | 
    
         
            -
                    super # let's first try the original method
         
     | 
| 
       15 
     | 
    
         
            -
                  rescue NameError # if we fail...
         
     | 
| 
      
 14 
     | 
    
         
            +
                    super # let's first try the original method.
         
     | 
| 
      
 15 
     | 
    
         
            +
                  rescue NameError => err # if we fail...
         
     | 
| 
       16 
16 
     | 
    
         
             
                    begin # ... let's try the abbreviation
         
     | 
| 
       17 
17 
     | 
    
         
             
                      super instances.find { |unit_inst|
         
     | 
| 
       18 
18 
     | 
    
         
             
                        unit_inst.short.to_s == arg.to_s if unit_inst.short
         
     | 
    
        data/lib/sy/version.rb
    CHANGED
    
    
    
        data/sy.gemspec
    CHANGED
    
    | 
         @@ -18,6 +18,8 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       18 
18 
     | 
    
         
             
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
       19 
19 
     | 
    
         
             
              spec.require_paths = ["lib"]
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
      
 21 
     | 
    
         
            +
              spec.add_dependency "y_support"
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
       21 
23 
     | 
    
         
             
              spec.add_development_dependency "bundler", "~> 1.7"
         
     | 
| 
       22 
24 
     | 
    
         
             
              spec.add_development_dependency "rake", "~> 10.0"
         
     | 
| 
       23 
25 
     | 
    
         
             
            end
         
     | 
    
        data/test/sy_test.rb
    CHANGED
    
    | 
         @@ -16,7 +16,6 @@ require './../lib/sy' 
     | 
|
| 
       16 
16 
     | 
    
         
             
            # *****************************************************************
         
     | 
| 
       17 
17 
     | 
    
         
             
            # THE SPECIFICATIONS START HERE
         
     | 
| 
       18 
18 
     | 
    
         
             
            # *****************************************************************
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
19 
     | 
    
         
             
            describe SY do
         
     | 
| 
       21 
20 
     | 
    
         
             
              it "should have basic assets" do
         
     | 
| 
       22 
21 
     | 
    
         
             
                # Basic physical dimensions:
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: sy
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.1.5
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Boris Stitnicky
         
     | 
| 
         @@ -10,6 +10,20 @@ bindir: bin 
     | 
|
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         
             
            date: 2016-06-22 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: y_support
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       13 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
28 
     | 
    
         
             
              name: bundler
         
     | 
| 
       15 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -91,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       91 
105 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       92 
106 
     | 
    
         
             
            requirements: []
         
     | 
| 
       93 
107 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       94 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 108 
     | 
    
         
            +
            rubygems_version: 2.5.1
         
     | 
| 
       95 
109 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       96 
110 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       97 
111 
     | 
    
         
             
            summary: Simple and concise way to express physical units.
         
     |