sy 2.0.19 → 2.0.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -31
  3. data/lib/sy/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b523d585e50b7c1180421f3a08847057165daea9
4
- data.tar.gz: 930162faffe96f611c8d61281375140e57922d6d
3
+ metadata.gz: 8188db91a1be774b2ea6858b9b690c5533664748
4
+ data.tar.gz: aac76cadeb0e3737136ecb6e81887ac8e4388b57
5
5
  SHA512:
6
- metadata.gz: d521ab97e1f86c694b88071f95f05c9ba3daf1e1148568d87d60d4c707311ab9dd3c7d5a779f679fcb646d69234e4db590af0189cf6fde0da57f784d51e2afe4
7
- data.tar.gz: 1235ecdf7122635a711e96e2b3ff0c739fc7417d37af57abed3b358a64c00110bb13b56af5bac4e14fc280cd31260e5671367e9c40f8560e13b83521b93cec55
6
+ metadata.gz: a89e002696b4d93d231d7733c40d6aa9753dc20f1ff517e06d3c44abddc7cc335ce5a5de5d9a20c3ac53533fea73a86f640282529b7eda205b3a2db593abe45c
7
+ data.tar.gz: 769545fec641a14f785b81884e2c71fb60fe6e25655796eef2352b63d27ada1eca88f7856c1ccd549a83484359799ee16bf58bb1598f94ef755fbdea2565f76a
data/README.md CHANGED
@@ -1,50 +1,50 @@
1
1
  # SY - The physical units library.
2
2
 
3
- The most prominent feature of SY is, that it extends the Numeric class
4
- with methods corresponding to units and their abbreviations. At this place,
5
- let me also make a polite mention of the other good physical units Ruby,
6
- phys-units by Masahiro Tanaka, which seem to be inspired by GNU units.
3
+ The most prominent feature of `SY` is, that it extends the `Numeric` class with
4
+ methods corresponding to units and their abbreviations. At this place, let me
5
+ also make a polite mention of the other good library of physical units in Ruby,
6
+ [phys-units](https://github.com/masa16/phys-units), inspired by GNU units.
7
7
 
8
8
  ## Usage
9
9
 
10
- Upon require 'sy', we can say 5.metre, or Rational( 5, 2 ).metre, and the
11
- computer will understand, that these numbers represent magnitudes of the
12
- physical quantity SY::Length expressed in the unit SY::METRE. Equally,
13
- we can use abbreviations (such as 5.m, 2.5.m), prefixes (such as 5.km,
14
- 5.kilometre, 5.km), exponents (such as 5.m² for 5 square metres) and
15
- chaining (such as 5.m.s⁻¹ to denote speed of 5 metres per second). Please
16
- read also the code file lib/sy.rb, where you can find the examples of the
17
- DSL used to define quantities and their units.
10
+ Upon `require 'sy'`, we can say `5.metre`, or `Rational( 5, 2 ).metre`, and
11
+ the computer will understand, that these numbers represent magnitudes of
12
+ the physical quantity `SY::Length` expressed in the unit `SY::METRE`. Equally,
13
+ we can use abbreviations (such as `5.m`, `2.5.m`), prefixes (such as `5.km`,
14
+ `5.kilometre`, `5.km`), exponents (such as `5.m²` for 5 square metres), and
15
+ chaining (such as `5.m.s⁻¹` to denote speed of 5 metres per second). Please
16
+ read also the code file lib/sy.rb for the DSL statements defining default
17
+ quantities and their units.
18
18
 
19
19
  ## Unicode exponents
20
20
 
21
21
  You should definitely learn how to type Unicode exponent characters, such
22
- as ², ³, ⁻¹ etc. It is possible to use alterantive syntax such as 5.m.s(-1)
23
- instead of 5.m.s⁻¹, but Unicode exponents should be used everywere except
24
- non-reused code. Unicode exponents make the physical models that you will
25
- be constructing with SY much more readable. And we know that code is (usually)
26
- write once, read many times. So it pays off to type an extra keystroke when
27
- writing, and that way buy more model readability for the many subsequent
22
+ as `²`, `³`, `⁻¹` etc. It is possible to use alterantive syntax, such as
23
+ `5.m.s(-1)` instead of `5.m.s⁻¹`, but Unicode exponents should be used
24
+ everywere except non-reused code. Unicode exponents make the physical models
25
+ that you will be constructing with SY much more readable. And we know that
26
+ code is (typically) write once, read many times. So it pays off to type an
27
+ extra keystroke when writing to increase readability for the many subsequent
28
28
  revisions.
29
29
 
30
30
  ## Method collisions
31
31
 
32
- One more remark here would be, that due to the fact, that many unit names
33
- and abbreviations are very short and common words, there can be collisions.
34
- For example ActiveSupport already provides handling for time units (hour,
35
- minute, second etc.), which would collide with SY methods of the same name.
36
- Since SY relies on method_missing, if these methods are already defined for
37
- numerics, SY's method_missing will not activate and ActiveSupport methods
38
- will be used. In this particular case, SY methods still can be invoked using
39
- abbreviations (5.s, 5.h, 5.min).
32
+ As a tribute to pragmatism (I like to think), `SY` extends Numeric with unit
33
+ methods and their abbreviations. The downside is, that since many of these are
34
+ short and common words, there can be collisions. For example, `ActiveSupport`
35
+ already provides handling for time units (hour, minute, second etc.), which
36
+ would collide with SY methods of the same name. Since `SY` relies on `method
37
+ _missing`, if these methods are already defined for numerics, `SY`'s
38
+ method_missing will not activate and ActiveSupport methods will be used. In
39
+ this particular case, `SY` methods still can be invoked using abbreviations
40
+ (`5.s`, `5.h`, `5.min`).
40
41
 
41
42
  ## Contributing
42
43
 
43
- SY has been written emphasizing the object model over plentitude of defined
44
- units. There is plenty of room for defining units thus far not defined by SY.
45
- Also, the object model, though advanced, could possibly be refactored, eg.
46
- with respect to the way that parametrized descendants of Magnitude are
47
- introduced.
44
+ `SY` has been written emphasizing the object model over plentitude of defined
45
+ units. There is plenty of room for defining units thus far not defined by `SY`.
46
+ Also, the object model, though advanced, could possibly be refactored, eg. with
47
+ respect to the way that parametrized descendants of `Magnitude` are introduced.
48
48
 
49
49
  1. Fork it
50
50
  2. Create your feature branch (`git checkout -b my-new-feature`)
data/lib/sy/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module SY
2
- VERSION = "2.0.19"
2
+ VERSION = "2.0.20"
3
3
  DEBUG = false # debug mode switch - sometimes there are lines like
4
4
  # puts "something" if SY::DEBUG
5
5
  end
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.0.19
4
+ version: 2.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - boris