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 +4 -4
- data/Changelog.md +5 -0
- data/lib/active_model_attributes.rb +2 -1
- data/lib/active_model_attributes/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c49da03aa0faec3a7808398462fad6f2a56addcc
|
4
|
+
data.tar.gz: c487a5895d6fa7e6ddc1a0141718796fd3341ac4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1a46b3b9307f55a21d0fefdcc7154d626bdfbd297b68a766476387bad26f6f4d61c9737418d10c6bc3c7411a23b12cf15402e99ad0efa40de881fa58e36d2cb
|
7
|
+
data.tar.gz: 3ba9f0f0d1aec8ddd15596a7370e1f4a470bf301cc75eebcfa4da7a88c1cf686311ce9337eda2dd4d577d31e5dfe8cc22f36b9f3a34b02e0ee4fac21b2f3733f
|
data/Changelog.md
CHANGED
@@ -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
|
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.
|
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:
|
11
|
+
date: 2017-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|