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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 984709117b437eb9982b3d09d02ad28c1d90db7c
4
- data.tar.gz: b2db20e28dc3c33d07a9d839406bffe12f855ca3
3
+ metadata.gz: fb8d123fefcbe3daf695cb9dcf93e2e147c63695
4
+ data.tar.gz: 8f9b0a8d24ba30ff273d26d7660e921dd63d60e3
5
5
  SHA512:
6
- metadata.gz: a7163b31cff91894c4c70f71005a40cca2b2e65869f943a17906d4798512a790d497c35e3b8bf1a5e15f2420c60d3b5536ca23ef441fd409bd822a381c652d82
7
- data.tar.gz: 335eb71d98c7445638c5ef2911251f495af0d314e8a614532909be22d428889ec9e883867d3bf8959a4f98eb6bb2319d02abb62a3b7bd2986c75a2ded9de53fd
6
+ metadata.gz: 0c43e2acb080c205130d21282ce342886dccefa651941c516d9eb73b3cb31c8861c683d1f2465cf0424a085ac9bc637477733a6be45dc9eb959b3ae01f60b594
7
+ data.tar.gz: 38e06a95c686ca5cfef9fc47059be0c771bf8cdcc8820795faa94f27c7963f924c512c3e860417eb0fd0f830298bc8ba436ddbc9396cdd87bb6d7f330f1393b3
@@ -1,3 +1,3 @@
1
1
  module Weighable
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
@@ -122,13 +122,21 @@ module Weighable
122
122
  end
123
123
 
124
124
  def *(other)
125
- other = other.to(unit_name)
126
- Weight.new(@value * other.value, unit_name)
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
- other = other.to(unit_name)
131
- Weight.new(@value / other.value, unit_name)
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.2.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-03-31 00:00:00.000000000 Z
11
+ date: 2016-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport