weighable 0.1.1 → 0.1.2

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: 17e7bee879cdfb4aca37dd69d5677c39c6a6a221
4
- data.tar.gz: 756192d72542ae5bcb60e457e9ee8fa8f22fcf02
3
+ metadata.gz: b27300c8013436a8e24bf525c1f4146d95805f6a
4
+ data.tar.gz: 42aebf7aaa52ec57e0b67aed44bf6230207fee78
5
5
  SHA512:
6
- metadata.gz: f66202def0fab1ca40c610dc71bfb34ecad05922e471975e1747706dba87209dbf89a69ff26e260f08acfb4d1e92748d643d935344ccadd88edc9ef1aab22d12
7
- data.tar.gz: 929f67f8295a99423b0f7d914b60cb5b70635a523e25be2d28b7157a7d2900a9cb6fae788debcc6049bb2032f17ec3ea8b5e3bee6db416ab6f3e49bd24c015e9
6
+ metadata.gz: 78edf2c2c8733a61031947acd64fa55ab1fc95d66838c4896baf41dd5cc1cba00de0d6a4250cda474efc69de9bbc44971601aedc157e52a10bd8b27dfacbdf65
7
+ data.tar.gz: 7eea7a42375d276333f7b4cd5a8052dd04b09aea542f17286eff9ad8c8debea4895f0732085fa16de65905adb6b484a891383e9d87c2cf0fce623fdc239d99ba
@@ -9,7 +9,10 @@ module Weighable
9
9
  define_method "#{column}=" do |weight|
10
10
  weight = Weight.new(weight['value'], weight['unit']) if weight.is_a?(Hash)
11
11
  original_unit = weight.try(:unit)
12
- weight = weight.try(:to, store_as) if original_unit && original_unit != :unit
12
+
13
+ if original_unit && original_unit != Weight::UNIT[:unit]
14
+ weight = weight.try(:to, store_as)
15
+ end
13
16
 
14
17
  public_send("#{column}_value=", weight.try(:value))
15
18
  public_send("#{column}_unit=", weight.try(:unit))
@@ -1,3 +1,3 @@
1
1
  module Weighable
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weighable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trae Robrock