This project is archived and is in readonly mode.
Problem using merge conditions with orderedhashes
-
pedm
Uhh oh, I didn't format that right. What I meant was:
@@ ruby
2}>
-
pedm
Okay one more try:
<O_r_d_e_r_e_d_H_a_s_h {9=>2}>
-
Ryan Bigg
I talked with pedm in #rubyonrails about this and we realised that merge for OrderedHash does not implement the block syntax of the merge from Hash.
-
pedm
Thanks, that's a much better way of saying it!
-
İ. Emre Kutlu
so will it be implemented or what? Lack of block syntax breaks the deep_merge, too.
-
İ. Emre Kutlu
maybe this helps ordered_hash_merge_with_block.rb
-
dohmoose
- Tag changed from merge, orderedhash to merge, orderedhash, patch
created patch for accepting block for merge.
İzzet Emre Kutlu, I put in a test for deep merge for ordered hash and it worked ok with no modifications, am I missing something? -
İ. Emre Kutlu
I check the tests. At test_deep_merge i think other_hash[:deep] not merged just returned.
I added a test to the gist http://gist.github.com/274118 .Can you please check this test? -
dohmoose
- Tag changed from merge, orderedhash, patch to merge, orderedhash
I replaced my test with your test, and also fixed the asserts (I had put in 'assert' not 'assert_equal'). Deep merge still worked, however, test_deep_block_merge failed. When I put in your deep merge code, that broke the 'test_deep_merge_on_indifferent_access' test in hash_ext_test.rb
This version of deep_merge passes all tests but its pretty ugly :(
What do you think?
http://gist.github.com/436339 -
İ. Emre Kutlu
I think "is_a?" method did the trick.
About being ugly, if i were you, i would write that code like this (which will be called uglier by most people :) ). So it is about the style.
-
José Valim
This was fixed on master a few days ago!
