weighable 0.8.1 → 0.9.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: a155dbbd10cee4a21cc13ebc1a5a969300769ad4
4
- data.tar.gz: 4f97a0edd85e49594f10e5943ecf33ee24bc0205
3
+ metadata.gz: 466560269b82c5abdfb14f87cf477906cdcd791c
4
+ data.tar.gz: a1c58752b469af1c7ccc709ea7186028b67cddb8
5
5
  SHA512:
6
- metadata.gz: ceeea2e12b3fe8a059ccdbc5c6b0b4f2aff15507c000c9ebf7c6e223682f95929b4700d47d009313fab67b0b5d7c61cf07ca92fdd3c10b3398283d62d15ff040
7
- data.tar.gz: 80ce64586b1c5ef60d9a8904676e1e52e90b0e7f755d5d8a8d600b8686cdc690fc53c51f752911f44118270f836187f3a963c952aba93ef4576321897041c1bb
6
+ metadata.gz: 7bc750cc906e88c464bd43aaef8bb47f5946eded3e14d5e98848a93ee4c820d840137ed96f71d3c69cc785199f8611c9d4425b15d9cc3e81d0e145bd51dd79dc
7
+ data.tar.gz: 387e334f16d5e0d0d9a398cfb3faa8783ecdeb6c7aa043ba1071488e266c8f30372a59a33b425e67f0ef521ceeb6567ea13d41eebb05329f4e40f42972f03a40
@@ -1 +1 @@
1
- 2.2.6
1
+ 2.2.8
@@ -1,3 +1,3 @@
1
1
  module Weighable
2
- VERSION = '0.8.1'.freeze
2
+ VERSION = '0.9.0'.freeze
3
3
  end
@@ -2,6 +2,8 @@ require 'active_support/inflector/methods'
2
2
 
3
3
  module Weighable
4
4
  class Weight
5
+ include Comparable
6
+
5
7
  attr_reader :value, :unit
6
8
 
7
9
  UNIT = {
@@ -191,6 +193,11 @@ module Weighable
191
193
  @value >= other.value
192
194
  end
193
195
 
196
+ def <=>(other)
197
+ other = other.to(unit_name)
198
+ @value <=> other.value
199
+ end
200
+
194
201
  def round(precision = 0)
195
202
  @value = @value.round(precision)
196
203
  self
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.8.1
4
+ version: 0.9.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: 2017-09-26 00:00:00.000000000 Z
11
+ date: 2017-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -161,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  version: '0'
162
162
  requirements: []
163
163
  rubyforge_project:
164
- rubygems_version: 2.4.5.2
164
+ rubygems_version: 2.4.5.3
165
165
  signing_key:
166
166
  specification_version: 4
167
167
  summary: Like BigDecimal, but for weight. Includes Rails integration.