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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05a4502f974a88c613b402394d0e303bac458836
4
- data.tar.gz: 799053c77aef863d27d6d5e816289a26fe48952d
3
+ metadata.gz: 9f19be8e030d6377ea6aa6ca7b63ea7d4a9f75d3
4
+ data.tar.gz: 2aff716401174198bdb2b8818c30c51804ec1fa8
5
5
  SHA512:
6
- metadata.gz: 9d83e13e2eac8a780dce7ea70f9f578586bbf749e9d1aec39345b9a6d5f0b4dc24754ce0cfd81671cddef6016cc6a242a1885e3b0be09f827cd410139c6a6d8d
7
- data.tar.gz: 90f1266a32befff128873f820ebc679ff97de0a5f3325724864f3b24b7e4c9d32b8b50d362a256419a886f5ab61f9ac8bf0af087d2915422b6f5aa9b956e6bb5
6
+ metadata.gz: ed78358832fc839cf646ab5cf269c8353dda7b55ce8cfb2486ad3d0d16135e5baa68d60447e4bcb077da838ab69459d3ac6f56a2411cac685ad86ad1206e9bc1
7
+ data.tar.gz: 2256ba70404f56dc4d509e78727d2343028292de4934b4f964743ab8345b0cbf6db21701c7a2c3442bccec68b44c3d0d8d6da9bc724089a145916c0dfa135a1c
@@ -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
@@ -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
- .tap { |u| ( units << u ).uniq! } # add it to the @units array
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).
@@ -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
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
2
 
3
3
  module SY
4
- VERSION = "2.1.4"
4
+ VERSION = "2.1.5"
5
5
  end
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
@@ -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
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.2.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.