sy 2.0.18 → 2.0.19

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 +42 -18
  3. data/lib/sy/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8f9f7390d20ebd9be2e00dea57e39a1c36de4df
4
- data.tar.gz: 91e9d5e9b85fc8789742ec150c2e7760f79f1f8d
3
+ metadata.gz: b523d585e50b7c1180421f3a08847057165daea9
4
+ data.tar.gz: 930162faffe96f611c8d61281375140e57922d6d
5
5
  SHA512:
6
- metadata.gz: 92a5a1360619fe9473357eb3a350baa2839b6c8084c4011ccda4152f975249e60c7f7d7f02d71a3dfcbb53e9e799ba24cef8a92be9273a877fc4f6472c361f53
7
- data.tar.gz: bf86c5bbeac6c81f5f6c32552e17532c1761cb8dbeee256dcd532d1dbbe57472ad079f7bd324feb098217bfa9c7a26625107cd2dd7e9fe4c5f338834930050b4
6
+ metadata.gz: d521ab97e1f86c694b88071f95f05c9ba3daf1e1148568d87d60d4c707311ab9dd3c7d5a779f679fcb646d69234e4db590af0189cf6fde0da57f784d51e2afe4
7
+ data.tar.gz: 1235ecdf7122635a711e96e2b3ff0c739fc7417d37af57abed3b358a64c00110bb13b56af5bac4e14fc280cd31260e5671367e9c40f8560e13b83521b93cec55
data/README.md CHANGED
@@ -1,29 +1,53 @@
1
- # Sy
1
+ # SY - The physical units library.
2
2
 
3
- TODO: Write a gem description
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'sy'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install sy
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.
18
7
 
19
8
  ## Usage
20
9
 
21
- TODO: Write usage instructions here
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.
18
+
19
+ ## Unicode exponents
20
+
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
28
+ revisions.
29
+
30
+ ## Method collisions
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).
22
40
 
23
41
  ## Contributing
24
42
 
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.
48
+
25
49
  1. Fork it
26
50
  2. Create your feature branch (`git checkout -b my-new-feature`)
27
51
  3. Commit your changes (`git commit -am 'Added some feature'`)
28
52
  4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
53
+ 5. Create new Pull Request
data/lib/sy/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module SY
2
- VERSION = "2.0.18"
2
+ VERSION = "2.0.19"
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.18
4
+ version: 2.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - boris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-15 00:00:00.000000000 Z
11
+ date: 2013-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport