weighable 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b27300c8013436a8e24bf525c1f4146d95805f6a
4
- data.tar.gz: 42aebf7aaa52ec57e0b67aed44bf6230207fee78
3
+ metadata.gz: 984709117b437eb9982b3d09d02ad28c1d90db7c
4
+ data.tar.gz: b2db20e28dc3c33d07a9d839406bffe12f855ca3
5
5
  SHA512:
6
- metadata.gz: 78edf2c2c8733a61031947acd64fa55ab1fc95d66838c4896baf41dd5cc1cba00de0d6a4250cda474efc69de9bbc44971601aedc157e52a10bd8b27dfacbdf65
7
- data.tar.gz: 7eea7a42375d276333f7b4cd5a8052dd04b09aea542f17286eff9ad8c8debea4895f0732085fa16de65905adb6b484a891383e9d87c2cf0fce623fdc239d99ba
6
+ metadata.gz: a7163b31cff91894c4c70f71005a40cca2b2e65869f943a17906d4798512a790d497c35e3b8bf1a5e15f2420c60d3b5536ca23ef441fd409bd822a381c652d82
7
+ data.tar.gz: 335eb71d98c7445638c5ef2911251f495af0d314e8a614532909be22d428889ec9e883867d3bf8959a4f98eb6bb2319d02abb62a3b7bd2986c75a2ded9de53fd
@@ -1,3 +1,3 @@
1
1
  module Weighable
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
@@ -111,10 +111,6 @@ module Weighable
111
111
  end
112
112
  end
113
113
 
114
- def ==(other)
115
- other.class == self.class && other.value == @value && other.unit == @unit
116
- end
117
-
118
114
  def +(other)
119
115
  other = other.to(unit_name)
120
116
  Weight.new(@value + other.value, unit_name)
@@ -130,16 +126,40 @@ module Weighable
130
126
  Weight.new(@value * other.value, unit_name)
131
127
  end
132
128
 
133
- def round(precision = 0)
134
- @value = @value.round(precision)
135
- self
136
- end
137
-
138
129
  def /(other)
139
130
  other = other.to(unit_name)
140
131
  Weight.new(@value / other.value, unit_name)
141
132
  end
142
133
 
134
+ def ==(other)
135
+ other.class == self.class && other.value == @value && other.unit == @unit
136
+ end
137
+
138
+ def <(other)
139
+ other = other.to(unit_name)
140
+ @value < other.value
141
+ end
142
+
143
+ def <=(other)
144
+ other = other.to(unit_name)
145
+ @value <= other.value
146
+ end
147
+
148
+ def >(other)
149
+ other = other.to(unit_name)
150
+ @value > other.value
151
+ end
152
+
153
+ def >=(other)
154
+ other = other.to(unit_name)
155
+ @value >= other.value
156
+ end
157
+
158
+ def round(precision = 0)
159
+ @value = @value.round(precision)
160
+ self
161
+ end
162
+
143
163
  private
144
164
 
145
165
  def unit_name
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.1.2
4
+ version: 0.2.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-30 00:00:00.000000000 Z
11
+ date: 2016-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport