summaryrefslogtreecommitdiff
path: root/lib/hashie/extensions/dash/property_translation.rb
diff options
context:
space:
mode:
authorDaniel Lee <danwa5@gmail.com>2021-06-17 14:05:59 -0700
committerDaniel Lee <danwa5@gmail.com>2021-06-17 14:17:43 -0700
commite295a0df579525ab1574a8ff6539a6c5a109fb2c (patch)
treec423787a0a907e03e8f7880361d851dab80942dd /lib/hashie/extensions/dash/property_translation.rb
parentae55d8ed7502ed677b78a4d75cb52231d4f14c23 (diff)
downloadhashie-e295a0df579525ab1574a8ff6539a6c5a109fb2c.tar.gz
Fixed issue where a source hash key can be used in translating multiple properties
Diffstat (limited to 'lib/hashie/extensions/dash/property_translation.rb')
-rw-r--r--lib/hashie/extensions/dash/property_translation.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/hashie/extensions/dash/property_translation.rb b/lib/hashie/extensions/dash/property_translation.rb
index 8149faa..69a2d71 100644
--- a/lib/hashie/extensions/dash/property_translation.rb
+++ b/lib/hashie/extensions/dash/property_translation.rb
@@ -153,7 +153,12 @@ module Hashie
def []=(property, value)
if self.class.translation_exists? property
send("#{property}=", value)
- super(property, value) if self.class.properties.include?(property)
+
+ if self.class.transformation_exists? property
+ super property, self.class.transformed_property(property, value)
+ elsif self.class.properties.include?(property)
+ super(property, value)
+ end
elsif self.class.transformation_exists? property
super property, self.class.transformed_property(property, value)
elsif property_exists? property