-
-
Save dgmcguire/c24951c036e5d34978f6 to your computer and use it in GitHub Desktop.
weird hash onto array behavior
This file contains 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
s.each do |i| | |
i.bindings.each do |k,v| | |
hash = Hash[k.to_sym, v.to_s] | |
attrs.merge!(hash) | |
end | |
p attrs | |
container_array << attrs | |
p container_array | |
end | |
#p output=> {:uri=>"http://facade.mit.edu/dataset/test", :name=>"test", :description=>"", :path=>"project"} | |
[{:uri=>"http://facade.mit.edu/dataset/test", :name=>"test", :description=>"", :path=>"project"}] | |
{:uri=>"http://facade.mit.edu/dataset/new", :name=>"new", :description=>"", :path=>"project"} | |
[{:uri=>"http://facade.mit.edu/dataset/new", :name=>"new", :description=>"", :path=>"project"}, {:uri=>"http://facade.mit.edu/dataset/new", :name=>"new", :description=>"", :path=>"project"}] | |
#final array=> [{:uri=>"http://facade.mit.edu/dataset/new", :name=>"new", :description=>"", :path=>"project"}, {:uri=>"http://facade.mit.edu/dataset/new", :name=>"new", :description=>"", :path=>"project"}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment