sy 2.1.0 → 2.1.1
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/.gitignore +16 -15
- data/{LICENSE → LICENSE.txt} +2 -2
- data/Rakefile +1 -1
- data/iupac_green.pdf +0 -0
- data/lib/sy.rb +2 -2
- data/lib/sy/absolute_magnitude.rb +3 -2
- data/lib/sy/composition.rb +1 -1
- data/lib/sy/dimension.rb +2 -1
- data/lib/sy/expressible_in_units.rb +3 -2
- data/lib/sy/fixed_assets_of_the_module.rb +10 -9
- data/lib/sy/imperial.rb +4 -1
- data/lib/sy/magnitude.rb +1 -1
- data/lib/sy/mapping.rb +2 -1
- data/lib/sy/matrix.rb +1 -1
- data/lib/sy/measure.rb +2 -1
- data/lib/sy/noinclude.rb +1 -1
- data/lib/sy/quantity.rb +1 -1
- data/lib/sy/signed_magnitude.rb +2 -1
- data/lib/sy/unit.rb +1 -1
- data/lib/sy/version.rb +3 -1
- data/lib/sy/wildcard_zero.rb +1 -1
- data/sy.gemspec +19 -15
- data/test/sy_test.rb +2 -2
- metadata +32 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f18cca23e5dbaf84f9891e046540d06850f21cd
|
4
|
+
data.tar.gz: 0be54fd6686547d8367ce0081c4c19da8c0a3094
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06602d4d119efc3a9db9f43aba372a557657e1eb1126cc028ed1368485f8182409dee7a4f0f2ac5a848e48050a69b3d3102550ccfa101cd9cc14986b4686b1f4
|
7
|
+
data.tar.gz: 41f838368c2b5bff694a1932dcf241de00278a41acde5d5c587abe6d4722344bcbc94a5fc4d0d365bea30cab53e67de5f5a46642b9ca33c2c86af6294950c8b4
|
data/.gitignore
CHANGED
@@ -1,20 +1,21 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
*.bundle
|
11
|
+
*.so
|
12
|
+
*.o
|
13
|
+
*.a
|
14
|
+
mkmf.log
|
1
15
|
*~
|
2
16
|
.#*
|
3
17
|
\#*#
|
4
18
|
*.gem
|
5
19
|
*.rbc
|
6
|
-
|
7
|
-
|
8
|
-
.yardoc
|
9
|
-
Gemfile.lock
|
10
|
-
InstalledFiles
|
11
|
-
_yardoc
|
12
|
-
coverage
|
13
|
-
doc/
|
14
|
-
lib/bundler/man
|
15
|
-
pkg
|
16
|
-
rdoc
|
17
|
-
spec/reports
|
18
|
-
test/tmp
|
19
|
-
test/version_tmp
|
20
|
-
tmp
|
20
|
+
/.config/
|
21
|
+
/rdoc/
|
data/{LICENSE → LICENSE.txt}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c)
|
1
|
+
Copyright (c) 2015 Boris Stitnicky
|
2
2
|
|
3
3
|
MIT License
|
4
4
|
|
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
data/iupac_green.pdf
ADDED
Binary file
|
data/lib/sy.rb
CHANGED
@@ -55,7 +55,7 @@ module SY
|
|
55
55
|
AUTOINCLUDE = true unless defined? ::SY::AUTOINCLUDE
|
56
56
|
end
|
57
57
|
|
58
|
-
Numeric.class_exec { include
|
58
|
+
Numeric.class_exec { include SY::ExpressibleInUnits } if SY::AUTOINCLUDE
|
59
59
|
|
60
60
|
# === Instead of introduction
|
61
61
|
#
|
@@ -351,4 +351,4 @@ module SY
|
|
351
351
|
ELEMENTARY_CHARGE = 1.60217656535e-19 * COULOMB
|
352
352
|
|
353
353
|
ELECTRONVOLT = Unit.of Energy, short: "eV", amount: ELEMENTARY_CHARGE * VOLT
|
354
|
-
end
|
354
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# coding: utf-8
|
2
|
+
|
2
3
|
# Qualities specific to absolute magnitudes (mixin).
|
3
4
|
#
|
4
5
|
# Absolute magnitude may not be negative – physical amounts cannot have
|
@@ -114,4 +115,4 @@ module SY::AbsoluteMagnitude
|
|
114
115
|
def çς
|
115
116
|
"Magnitude"
|
116
117
|
end
|
117
|
-
end # class SY::
|
118
|
+
end # class SY::AbsoluteMagnitude
|
data/lib/sy/composition.rb
CHANGED
data/lib/sy/dimension.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# coding: utf-8
|
2
|
+
|
2
3
|
# This mixin provides ability to respond to SY unit symbol methods.
|
3
4
|
#
|
4
5
|
module SY::ExpressibleInUnits
|
@@ -234,4 +235,4 @@ module SY::ExpressibleInUnits
|
|
234
235
|
# beginning, certain methods for certain classes, to get in front of possible
|
235
236
|
# collisions. Collision was detected for example for #second with
|
236
237
|
# active_support/duration.rb
|
237
|
-
end
|
238
|
+
end
|
@@ -1,22 +1,23 @@
|
|
1
|
-
#
|
1
|
+
# coding: utf-8
|
2
|
+
|
2
3
|
# Here, fixed assets of the main module are set up.
|
3
4
|
#
|
4
5
|
module SY
|
5
|
-
QuantityError = Class.new TypeError
|
6
|
-
DimensionError = Class.new TypeError #
|
6
|
+
QuantityError = Class.new TypeError # incompatible quantities
|
7
|
+
DimensionError = Class.new TypeError # incompatible dimensions
|
7
8
|
MagnitudeError = Class.new TypeError # creating impossible magnitude
|
8
9
|
|
9
10
|
BASE_DIMENSIONS = { # Basic physical dimensions.
|
10
11
|
L: :LENGTH,
|
11
12
|
M: :MASS,
|
12
|
-
|
13
|
+
T: :TIME,
|
14
|
+
Q: :ELECTRIC_CHARGE, # instead of electric current
|
13
15
|
Θ: :TEMPERATURE,
|
14
|
-
|
15
|
-
}
|
16
|
+
} # amount of substance and luminous intensity omitted
|
16
17
|
|
17
18
|
class << BASE_DIMENSIONS
|
18
|
-
# Letters of base dimensions.
|
19
|
-
#
|
19
|
+
# Letters of the base dimensions.
|
20
|
+
#
|
20
21
|
def letters
|
21
22
|
keys
|
22
23
|
end
|
@@ -44,7 +45,7 @@ module SY
|
|
44
45
|
end
|
45
46
|
end
|
46
47
|
|
47
|
-
|
48
|
+
# Table of standard prefixes and their corresponding unit multiples.
|
48
49
|
#
|
49
50
|
PREFIX_TABLE = [ { full: "exa", short: "E", factor: 1e18 },
|
50
51
|
{ full: "peta", short: "P", factor: 1e15 },
|
data/lib/sy/imperial.rb
CHANGED
data/lib/sy/magnitude.rb
CHANGED
data/lib/sy/mapping.rb
CHANGED
data/lib/sy/matrix.rb
CHANGED
data/lib/sy/measure.rb
CHANGED
data/lib/sy/noinclude.rb
CHANGED
data/lib/sy/quantity.rb
CHANGED
data/lib/sy/signed_magnitude.rb
CHANGED
data/lib/sy/unit.rb
CHANGED
data/lib/sy/version.rb
CHANGED
data/lib/sy/wildcard_zero.rb
CHANGED
data/sy.gemspec
CHANGED
@@ -1,19 +1,23 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'sy/version'
|
3
5
|
|
4
|
-
Gem::Specification.new do |
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "sy"
|
8
|
+
spec.version = SY::VERSION
|
9
|
+
spec.authors = ["Boris Stitnicky"]
|
10
|
+
spec.email = ["borisstitnicky@centrum.cz"]
|
11
|
+
spec.summary = %q{Simple and concise way to express physical units.}
|
12
|
+
spec.description = %q{Physical units library}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
10
15
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
gem.require_paths = ["lib"]
|
16
|
-
gem.version = SY::VERSION
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
17
20
|
|
18
|
-
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
19
23
|
end
|
data/test/sy_test.rb
CHANGED
@@ -10,8 +10,8 @@ require 'mathn'
|
|
10
10
|
require 'minitest/autorun'
|
11
11
|
|
12
12
|
# The following will load SY library
|
13
|
-
|
14
|
-
require './../lib/sy'
|
13
|
+
require 'sy'
|
14
|
+
# require './../lib/sy'
|
15
15
|
|
16
16
|
# **************************************************************************
|
17
17
|
# THE SPECIFICATIONS START HERE
|
metadata
CHANGED
@@ -1,41 +1,56 @@
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Boris Stitnicky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
type: :
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
27
41
|
description: Physical units library
|
28
42
|
email:
|
29
|
-
-
|
43
|
+
- borisstitnicky@centrum.cz
|
30
44
|
executables: []
|
31
45
|
extensions: []
|
32
46
|
extra_rdoc_files: []
|
33
47
|
files:
|
34
|
-
- .gitignore
|
48
|
+
- ".gitignore"
|
35
49
|
- Gemfile
|
36
|
-
- LICENSE
|
50
|
+
- LICENSE.txt
|
37
51
|
- README.md
|
38
52
|
- Rakefile
|
53
|
+
- iupac_green.pdf
|
39
54
|
- lib/sy.rb
|
40
55
|
- lib/sy/absolute_magnitude.rb
|
41
56
|
- lib/sy/composition.rb
|
@@ -57,7 +72,8 @@ files:
|
|
57
72
|
- test/noinclude_test.rb
|
58
73
|
- test/sy_test.rb
|
59
74
|
homepage: ''
|
60
|
-
licenses:
|
75
|
+
licenses:
|
76
|
+
- MIT
|
61
77
|
metadata: {}
|
62
78
|
post_install_message:
|
63
79
|
rdoc_options: []
|
@@ -65,17 +81,17 @@ require_paths:
|
|
65
81
|
- lib
|
66
82
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
83
|
requirements:
|
68
|
-
- -
|
84
|
+
- - ">="
|
69
85
|
- !ruby/object:Gem::Version
|
70
86
|
version: '0'
|
71
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
88
|
requirements:
|
73
|
-
- -
|
89
|
+
- - ">="
|
74
90
|
- !ruby/object:Gem::Version
|
75
91
|
version: '0'
|
76
92
|
requirements: []
|
77
93
|
rubyforge_project:
|
78
|
-
rubygems_version: 2.
|
94
|
+
rubygems_version: 2.2.2
|
79
95
|
signing_key:
|
80
96
|
specification_version: 4
|
81
97
|
summary: Simple and concise way to express physical units.
|