active_model_attributes 1.0.0 → 1.1.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: 3801142572b024c4d211d44e922bd3cc629cc5e9
4
- data.tar.gz: 87716866f64b6e74c39a3389dbf01afc99542698
3
+ metadata.gz: c49da03aa0faec3a7808398462fad6f2a56addcc
4
+ data.tar.gz: c487a5895d6fa7e6ddc1a0141718796fd3341ac4
5
5
  SHA512:
6
- metadata.gz: cc6310f6b495d46392b84c4e6780857d55fc1b66eaadbbdbeb6f6d92768a9e9b16ee396d0b378fb42c1521c888be971cfabd1eeeed3d3545c20e1e49e2f51d13
7
- data.tar.gz: c875019c0cb39c14d7fb704f4a156bea8f26ad081612514d64b78a3909f6fc264c6e6d36cd73d0b790371a1812b715e71eebd8216febdc35c3a9fa646a90bcef
6
+ metadata.gz: e1a46b3b9307f55a21d0fefdcc7154d626bdfbd297b68a766476387bad26f6f4d61c9737418d10c6bc3c7411a23b12cf15402e99ad0efa40de881fa58e36d2cb
7
+ data.tar.gz: 3ba9f0f0d1aec8ddd15596a7370e1f4a470bf301cc75eebcfa4da7a88c1cf686311ce9337eda2dd4d577d31e5dfe8cc22f36b9f3a34b02e0ee4fac21b2f3733f
data/Changelog.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.1.0
6
+
7
+ Changes:
8
+ - [BUGFIX] Pass `options` argument to `ActiveModel::Type.lookup` in attribute writers @jughead
9
+
5
10
  ## 1.0.0
6
11
 
7
12
  Update notes:
@@ -12,6 +12,7 @@ module ActiveModelAttributes
12
12
 
13
13
  module ClassMethods
14
14
  NO_DEFAULT_PROVIDED = Object.new
15
+ SERVICE_ATTRIBUTES = %i(default user_provided_default).freeze
15
16
  private_constant :NO_DEFAULT_PROVIDED
16
17
 
17
18
  def attribute(name, cast_type, **options)
@@ -32,7 +33,7 @@ module ActiveModelAttributes
32
33
 
33
34
  def define_attribute_writer(name, cast_type, options)
34
35
  define_method "#{name}=" do |val|
35
- deserialized_value = ActiveModel::Type.lookup(cast_type).cast(val)
36
+ deserialized_value = ActiveModel::Type.lookup(cast_type, **options.except(*SERVICE_ATTRIBUTES)).cast(val)
36
37
  instance_variable_set("@#{name}", deserialized_value)
37
38
  end
38
39
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveModelAttributes
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_model_attributes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karol Galanciak
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-03 00:00:00.000000000 Z
11
+ date: 2017-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler