protip 0.18.7 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/protip/resource.rb +7 -8
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87a1c6e1b9c82896ae06af88f2e9b4bf27a7050a
4
- data.tar.gz: aa8ee22934fca9dd14964a91efeea888572e3513
3
+ metadata.gz: 476db8dfd984fed8f163c6bb7c1fbd90263edf66
4
+ data.tar.gz: 38baca64b99c979275fdc99c42d9d0465bb3be3c
5
5
  SHA512:
6
- metadata.gz: 1994203036d8aaafcb5d36ee5708d97a88f2c2b16772a4b2c969515884d24a2fc7ec1b4ad00ac09bee83c18ee07c32b5514b70ac9496cee54255e166da33562d
7
- data.tar.gz: 654378f70d1bf78adc4a02a246e425f9644347a098c43767e0d3910b31b3bf4218036fdf15f70edbe35ff05d6f4968c995c7474b4944f7a5e44843831c7ec85c
6
+ metadata.gz: b5d0986cd5e3467ec7f73990b26a6e53cc13a848348d4e679fa8624c2427194d09033a6d95416db8204724663ebccd140ea09401ed681c1017be86c5cdb5b0e9
7
+ data.tar.gz: 203784715d0d75c2a5a9f7d933e2e836a85e837a4dd68277f42f98a827698e18d829d92533e7bed254e6cd429729f6b1148bd0c58d6097d6ef8a379fcfac331f
@@ -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.each do |key|
270
- field = descriptor.lookup(key.to_s)
271
- value = message[key.to_s]
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
- attributes.keys.each do |key|
278
+ keys.each do |key|
278
279
  old_value = old_attributes[key]
279
- new_value = message[key.to_s]
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.18.7
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-03 00:00:00.000000000 Z
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.4.0
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.4.0
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