quantified 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b82fde76b902f73feeafc005768ef407964241c1
4
- data.tar.gz: b36878a61fde1cf01bb5b982295d15a66fa1317c
3
+ metadata.gz: 84ba6ca1ebcb53b0a7bae563f6c7f9d899bcad86
4
+ data.tar.gz: 93d065832067c0c4c5d6a80867d6b90fcfd11958
5
5
  SHA512:
6
- metadata.gz: eb74b18116d50c2cff3a550c47cd93569d901e96f6f265e73d6a27774401e9591dad3893de93e2beac5f3e45128b00fe73a57365b02973600f8a41d152fa5685
7
- data.tar.gz: 6b0391b2b1a160eefccacbdb7cfea0c210fb56fa2a4ca6cd549882c8c08f0052f0b1adb3aa806a156bc7c7a8a69159bc2844c9f876e57c1c813df4356d8fc93d
6
+ metadata.gz: 0d1ad95fbed7c90460f6d3cfec4f5f11c2003abfa593a24571f7007c056112db723f5f969032a57628361ace8a096789936defaa79710c8d5709e3fe11056d5c
7
+ data.tar.gz: f502a30054914e6ed2f9b805cf7260db8932ec4ab78cee9d993f552e243362fd25d450b9302c900565455e59bf438cde2a2b7368c11a8b82b8c4f0c702e758b9
@@ -2,18 +2,34 @@ module Quantified
2
2
  class Length < Attribute
3
3
  system :metric do
4
4
  primitive :metre
5
+ one :meter, :is => Length.new(1, :metres)
6
+ one :m, :plural => :m, :is => Length.new(1, :metres)
5
7
 
6
8
  one :centimetre, :is => Length.new(0.01, :metres)
9
+ one :centimeter, :is => Length.new(0.01, :metres)
10
+ one :cm, :plural => :cm, :is => Length.new(0.01, :metres)
11
+
7
12
  one :millimetre, :is => Length.new(0.1, :centimetres)
13
+ one :millimeter, :is => Length.new(0.1, :centimetres)
14
+ one :mm, :plural => :mm, :is => Length.new(0.1, :centimetres)
15
+
8
16
  one :kilometre, :is => Length.new(1000, :metres)
17
+ one :kilometer, :is => Length.new(1000, :metres)
18
+ one :km, :plural => :km, :is => Length.new(1000, :metres)
9
19
  end
10
20
 
11
21
  system :imperial do
12
22
  primitive :inch
23
+
13
24
  one :inch, :is => Length.new(0.0254, :metres)
25
+ one :in, :plural => :in, :is => Length.new(0.0254, :metres)
14
26
 
15
27
  one :foot, :plural => :feet, :is => Length.new(12, :inches)
28
+ one :ft, :plural => :ft, :is => Length.new(12, :inches)
29
+
16
30
  one :yard, :is => Length.new(3, :feet)
31
+ one :yd, :plural => :yd, :is => Length.new(3, :feet)
32
+
17
33
  one :mile, :is => Length.new(5280, :feet)
18
34
  end
19
35
  end
@@ -2,17 +2,29 @@ module Quantified
2
2
  class Mass < Attribute
3
3
  system :metric do
4
4
  primitive :gram
5
+ one :g, :plural => :g, :is => Mass.new(1, :grams)
5
6
 
6
7
  one :milligram, :is => Mass.new(0.001, :grams)
8
+ one :mg, :plural => :mg, :is => Mass.new(0.001, :grams)
9
+
10
+ one :carat, :is => Mass.new(0.2, :grams)
11
+ one :ct, :plural => :ct, :is => Mass.new(0.2, :grams)
12
+
7
13
  one :kilogram, :is => Mass.new(1000, :grams)
14
+ one :kg, :plural => :kg, :is => Mass.new(1000, :grams)
8
15
  end
9
16
 
10
17
  system :imperial do
11
18
  primitive :ounce
12
19
  one :ounce, :is => Mass.new(28.349523125, :grams)
20
+ one :oz, :plural => :oz, :is => Mass.new(28.349523125, :grams)
13
21
 
14
22
  one :pound, :is => Mass.new(16, :ounces)
23
+ one :lb, :plural => :lb, :is => Mass.new(16, :ounces)
24
+
15
25
  one :stone, :is => Mass.new(14, :pounds)
26
+ one :st, :plural => :st, :is => Mass.new(14, :pounds)
27
+
16
28
  one :short_ton, :is => Mass.new(2000, :pounds)
17
29
  end
18
30
  end
@@ -1,3 +1,3 @@
1
1
  module Quantified
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/test/length_test.rb CHANGED
@@ -85,8 +85,8 @@ class LengthTest < Test::Unit::TestCase
85
85
 
86
86
  def test_systems
87
87
  assert_equal [:metric, :imperial], Length.systems
88
- assert_equal [:metres, :centimetres, :millimetres, :kilometres], Length.units(:metric)
89
- assert_equal [:inches, :feet, :yards, :miles], Length.units(:imperial)
88
+ assert_equal [:metres, :meters, :m, :centimetres, :centimeters, :cm, :millimetres, :millimeters, :mm, :kilometres, :kilometers, :km], Length.units(:metric)
89
+ assert_equal [:inches, :in, :feet, :ft, :yards, :yd, :miles], Length.units(:imperial)
90
90
 
91
91
  assert_equal :metric, 2.centimetres.system
92
92
  assert_equal :imperial, 2.feet.system
data/test/mass_test.rb CHANGED
@@ -82,8 +82,8 @@ class MassTest < Test::Unit::TestCase
82
82
 
83
83
  def test_systems
84
84
  assert_equal [:metric, :imperial], Mass.systems
85
- assert_equal [:grams, :milligrams, :kilograms], Mass.units(:metric)
86
- assert_equal [:ounces, :pounds, :stones, :short_tons], Mass.units(:imperial)
85
+ assert_equal [:grams, :g, :milligrams, :mg, :carats, :ct, :kilograms, :kg], Mass.units(:metric)
86
+ assert_equal [:ounces, :oz, :pounds, :lb, :stones, :st, :short_tons], Mass.units(:imperial)
87
87
  end
88
88
 
89
89
  def test_right_side_comparison_with_fixnum
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quantified
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James MacAulay
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-26 00:00:00.000000000 Z
12
+ date: 2015-05-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake