weighable 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/weighable/version.rb +1 -1
- data/lib/weighable/weight.rb +12 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb8d123fefcbe3daf695cb9dcf93e2e147c63695
|
4
|
+
data.tar.gz: 8f9b0a8d24ba30ff273d26d7660e921dd63d60e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c43e2acb080c205130d21282ce342886dccefa651941c516d9eb73b3cb31c8861c683d1f2465cf0424a085ac9bc637477733a6be45dc9eb959b3ae01f60b594
|
7
|
+
data.tar.gz: 38e06a95c686ca5cfef9fc47059be0c771bf8cdcc8820795faa94f27c7963f924c512c3e860417eb0fd0f830298bc8ba436ddbc9396cdd87bb6d7f330f1393b3
|
data/lib/weighable/version.rb
CHANGED
data/lib/weighable/weight.rb
CHANGED
@@ -122,13 +122,21 @@ module Weighable
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def *(other)
|
125
|
-
|
126
|
-
|
125
|
+
if other.is_a? Weight
|
126
|
+
other = other.to(unit_name)
|
127
|
+
Weight.new(@value * other.value, unit_name)
|
128
|
+
else
|
129
|
+
Weight.new(@value * other, unit_name)
|
130
|
+
end
|
127
131
|
end
|
128
132
|
|
129
133
|
def /(other)
|
130
|
-
|
131
|
-
|
134
|
+
if other.is_a? Weight
|
135
|
+
other = other.to(unit_name)
|
136
|
+
BigDecimal.new(@value / other.value)
|
137
|
+
else
|
138
|
+
Weight.new(@value / other, unit_name)
|
139
|
+
end
|
132
140
|
end
|
133
141
|
|
134
142
|
def ==(other)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weighable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trae Robrock
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|