Created
June 27, 2014 14:45
-
-
Save justfalter/adc4f0d61f34a43a8bc5 to your computer and use it in GitHub Desktop.
Hashie IndifferentAccess assignment issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'hashie' | |
require 'pp' | |
class A < Hashie::Dash | |
include Hashie::Extensions::IndifferentAccess | |
property :some_array | |
property :some_hash | |
property :some_object | |
end | |
class B < Hashie::Dash | |
property :some_array | |
property :some_hash | |
property :some_object | |
end | |
hash_value = {} | |
array_value = [] | |
object = Object.new | |
a = A.new | |
b = B.new | |
a.some_hash = hash_value | |
a.some_array = array_value | |
a.some_object = object | |
b.some_hash = hash_value | |
b.some_array = array_value | |
b.some_object = object | |
pp [:a_hash, hash_value.object_id == a.some_hash.object_id] | |
pp [:a_array, array_value.object_id == a.some_array.object_id] | |
pp [:a_object, object.object_id == a.some_object.object_id] | |
pp [:b_hash, hash_value.object_id == b.some_hash.object_id] | |
pp [:b_array, array_value.object_id == b.some_array.object_id] | |
pp [:b_object, object.object_id == b.some_object.object_id] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment