weighable 1.3.0 → 1.4.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: 5928abf65b9ed912aa87130fc9f67218fdaa61ba
4
- data.tar.gz: 61f15d16c1b6ebc5102c1883cf9058d696f74a74
3
+ metadata.gz: c8771f8bc5700d552175e0e692dad7a1279abdee
4
+ data.tar.gz: 6d39188a5ef3d7a1748378e43db3faa734534927
5
5
  SHA512:
6
- metadata.gz: 1c965866fe0bbe5dc226d248a6d73f62dca950457825ddec68b91f53807cd4fbded7a2971964fbb57702ec96bd3fae7c2277bfcd08c6214144eac7c70e365591
7
- data.tar.gz: 7058d0b99f5bf5bd7de3dec83c54387b183aa00e1f66511b86a40b2231ffde11575df57c05dd33dc41d889edd3bed21cae652e15fbca88db955d29af3de5fe67
6
+ metadata.gz: 2af1a29ab674a088bf01e3e571e1154e7cc11ef6e6b604722b4a8d5cd0f5fab04602108c03ba1a731465f122e92d0db5b86a4376daff0e0e267215fa8e5b6e61
7
+ data.tar.gz: cecefe233f6b0eec510d0c371dde2f55ae2e2dcd768926427eea919295727db8d3d464e262d2355a38d36d667966c02c52fffa2d27d6a1c9eea0e6a091c1be55
@@ -13,7 +13,9 @@ module Weighable
13
13
 
14
14
  def define_setter(column, store_as: :gram, precision: nil)
15
15
  define_method "#{column}=" do |weight|
16
- weight = Weight.new(weight['value'], weight['unit']) if weight.is_a?(Hash)
16
+ if weight.respond_to?(:key?) && weight.key?('value') && weight.key?('unit')
17
+ weight = Weight.new(weight['value'], weight['unit'])
18
+ end
17
19
  original_unit = weight.try(:unit)
18
20
 
19
21
  if original_unit && original_unit != Weight::UNIT[:unit]
@@ -1,3 +1,3 @@
1
1
  module Weighable
2
- VERSION = '1.3.0'.freeze
2
+ VERSION = '1.4.0'.freeze
3
3
  end
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: 1.3.0
4
+ version: 1.4.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: 2019-05-13 00:00:00.000000000 Z
11
+ date: 2019-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport