property_sets 3.2.1 → 3.3.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: 537a0d1bb242604cbcc56a1ca36e470f2a6b801e
4
- data.tar.gz: d845adb423d5ce5607217b1cbf8410fbb7e15680
3
+ metadata.gz: 3ac3f25a9d664d3c11c22b27fcc295998bfa1ded
4
+ data.tar.gz: 6a46c42e0ec6ab7b07b750ea09660291c21a8735
5
5
  SHA512:
6
- metadata.gz: a8f469c438491d9b2670fe1553067db729960de8b5560be99ef16f0acb49acd10ea0bf84381170f3d25be47f702fb326d186c92f41c1b6bd59379868f21f17ff
7
- data.tar.gz: ecd439b869a49c327efa2f358bccdd1fd4f24b49a45ecbd6275c421d84bb6168450cef26fc8c4ee2f85903a6a8ef4ec1fc5cc19faac94800b3bfced04fd01e75
6
+ metadata.gz: a1eed5ef6c30432eedc454135c98463a3577f239c9f1b08de2af588133529eddf19c70e17625ca7091f8e1a5715069a52b4ef53eb4713bb6404a4aa2ee01bf72
7
+ data.tar.gz: 7e7d583269e88e7dd746f526bad20dfcbeec7c0af76cc9aa49d5e31692ceec41c4943a563e3bd08d2aad2c95b1a73088d691e63831d46b30e1b263d56675b4b6
@@ -85,7 +85,7 @@ module PropertySets
85
85
  property_pairs.keys.each do |name|
86
86
  record = lookup(name)
87
87
  if with_protection && record.protected?
88
- logger.warn("Someone tried to update the protected #{name} property to #{property_pairs[name]}")
88
+ association_class.logger.warn("Someone tried to update the protected #{name} property to #{property_pairs[name]}")
89
89
  else
90
90
  send("#{name}=", property_pairs[name])
91
91
  end
@@ -113,7 +113,7 @@ module PropertySets
113
113
  end
114
114
 
115
115
  def build_default(arg)
116
- build(:name => arg.to_s, :value => raw_default(arg))
116
+ build(:name => arg.to_s, :value => association_class.raw_default(arg))
117
117
  end
118
118
 
119
119
  def lookup_without_default(arg)
@@ -127,7 +127,7 @@ module PropertySets
127
127
  instance.value_serialized = serialized
128
128
  PropertySets::Casting.read(type, instance.value)
129
129
  else
130
- value = default(key)
130
+ value = association_class.default(key)
131
131
  if serialized
132
132
  PropertySets::Casting.deserialize(value)
133
133
  else
@@ -144,7 +144,7 @@ module PropertySets
144
144
 
145
145
  owner = proxy_association.owner
146
146
 
147
- instance.send("#{owner_class_sym}=", owner) if owner.new_record?
147
+ instance.send("#{association_class.owner_class_sym}=", owner) if owner.new_record?
148
148
  instance
149
149
  end
150
150
 
@@ -152,7 +152,7 @@ module PropertySets
152
152
  # It does not have the side effect of adding a new setting object.
153
153
  def lookup_or_default(arg)
154
154
  instance = lookup_without_default(arg)
155
- instance ||= association_class.new(:value => raw_default(arg))
155
+ instance ||= association_class.new(:value => association_class.raw_default(arg))
156
156
  instance.value_serialized = property_serialized?(arg)
157
157
  instance
158
158
  end
@@ -27,14 +27,14 @@ module PropertySets
27
27
  define_method("#{old_attr}=") { |value| send(setname).send("#{new_attr}=", value) }
28
28
 
29
29
  define_method("#{old_attr}_changed?") do
30
- assoc = send(setname)
31
- return false unless assoc.loaded?
32
- setting = assoc.lookup_without_default(new_attr)
30
+ collection_proxy = send(setname)
31
+ return false unless collection_proxy.loaded?
32
+ setting = collection_proxy.lookup_without_default(new_attr)
33
33
 
34
34
  if !setting
35
35
  false # Nothing has been set which means that the attribute hasn't changed
36
36
  elsif setting.new_record?
37
- assoc.default(new_attr) != setting.value
37
+ collection_proxy.association_class.default(new_attr) != setting.value
38
38
  else
39
39
  setting.value_changed?
40
40
  end
@@ -1,3 +1,3 @@
1
1
  module PropertySets
2
- VERSION = "3.2.1"
2
+ VERSION = "3.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: property_sets
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morten Primdahl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-10 00:00:00.000000000 Z
11
+ date: 2017-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord