Add a hash to an array?
I've currently got this hash:
{:residential=>"fal开发者_运维技巧se"}
But I need to make it an item of an array:
[{:residential=>"false"}]
How do I do that?
my_array = []
my_array << {:residential => "false"}
=> [{:residential=>"false"}]
The code you've already written should be just fine.
>> x = [{:residental=>"false"}, {:residental=>"true"}]
=> [{:residental=>"false"}, {:residental=>"true"}]
>> x[0][:residental]
=> "false"
精彩评论