diff options
author | Erol Fornoles <erol.fornoles@gmail.com> | 2014-12-29 07:57:43 +0800 |
---|---|---|
committer | Erol Fornoles <erol.fornoles@gmail.com> | 2014-12-29 07:57:43 +0800 |
commit | 97698e9bf6a249b52ead53292e96fa0af2177cdc (patch) | |
tree | 1b5f1f5bf2a4060c9ffb14b93af48317797156ca /lib/hashie/extensions/coercion.rb | |
parent | a4938721f95f732aa335e0fd0963269f388b9b07 (diff) | |
download | hashie-97698e9bf6a249b52ead53292e96fa0af2177cdc.tar.gz |
Refactor property definitions and initializations
Diffstat (limited to 'lib/hashie/extensions/coercion.rb')
-rw-r--r-- | lib/hashie/extensions/coercion.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/hashie/extensions/coercion.rb b/lib/hashie/extensions/coercion.rb index 601f21b..371ccf8 100644 --- a/lib/hashie/extensions/coercion.rb +++ b/lib/hashie/extensions/coercion.rb @@ -151,10 +151,10 @@ module Hashie end if options[:strict] - (@strict_value_coercions ||= {})[from] = into + strict_value_coercions[from] = into else while from.superclass && from.superclass != Object - (@lenient_value_coercions ||= {})[from] = into + lenient_value_coercions[from] = into from = from.superclass end end @@ -162,11 +162,11 @@ module Hashie # Return all value coercions that have the :strict rule as true. def strict_value_coercions - @strict_value_coercions || {} + @strict_value_coercions ||= {} end # Return all value coercions that have the :strict rule as false. def lenient_value_coercions - @value_coercions || {} + @lenient_value_coercions ||= {} end # Fetch the value coercion, if any, for the specified object. |