protip 0.18.7 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/protip/resource.rb +7 -8
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 476db8dfd984fed8f163c6bb7c1fbd90263edf66
|
4
|
+
data.tar.gz: 38baca64b99c979275fdc99c42d9d0465bb3be3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5d0986cd5e3467ec7f73990b26a6e53cc13a848348d4e679fa8624c2427194d09033a6d95416db8204724663ebccd140ea09401ed681c1017be86c5cdb5b0e9
|
7
|
+
data.tar.gz: 203784715d0d75c2a5a9f7d933e2e836a85e837a4dd68277f42f98a827698e18d829d92533e7bed254e6cd429729f6b1148bd0c58d6097d6ef8a379fcfac331f
|
data/lib/protip/resource.rb
CHANGED
@@ -266,17 +266,18 @@ module Protip
|
|
266
266
|
def assign_attributes(attributes)
|
267
267
|
old_attributes = {}
|
268
268
|
descriptor = message.class.descriptor
|
269
|
-
attributes.keys.
|
270
|
-
|
271
|
-
|
269
|
+
keys = attributes.keys.map(&:to_s)
|
270
|
+
keys.each do |key|
|
271
|
+
field = descriptor.lookup(key)
|
272
|
+
value = message[key]
|
272
273
|
# If the current value is a message, we need to clone it to get a reasonable comparison later,
|
273
274
|
# since we might just assign attributes to the current instance of the message directly
|
274
275
|
old_attributes[key] = field && field.type == :message && value ? value.clone : value
|
275
276
|
end
|
276
277
|
@wrapper.assign_attributes attributes
|
277
|
-
|
278
|
+
keys.each do |key|
|
278
279
|
old_value = old_attributes[key]
|
279
|
-
new_value = message[key
|
280
|
+
new_value = message[key]
|
280
281
|
unless old_value.class == new_value.class && old_value == new_value
|
281
282
|
send "#{key}_will_change!"
|
282
283
|
end
|
@@ -327,12 +328,10 @@ module Protip
|
|
327
328
|
end
|
328
329
|
|
329
330
|
private
|
330
|
-
|
331
|
-
# needed for ActiveModel::Dirty
|
331
|
+
# needed for ActiveModel::Dirty in earlier ActiveModel versions
|
332
332
|
def changes_applied
|
333
333
|
@previously_changed = changes
|
334
334
|
@changed_attributes.clear
|
335
335
|
end
|
336
|
-
|
337
336
|
end
|
338
337
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AngelList
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
requirements:
|
57
57
|
- - '='
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 3.0.0.alpha.
|
59
|
+
version: 3.0.0.alpha.5.0.3
|
60
60
|
type: :runtime
|
61
61
|
prerelease: false
|
62
62
|
version_requirements: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
64
|
- - '='
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: 3.0.0.alpha.
|
66
|
+
version: 3.0.0.alpha.5.0.3
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: money
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|