ruby - 求教 rails 获取数据值方法
PHP中文网
PHP中文网 2017-04-22 09:00:41
0
1
598

菜鸟求教,如何rails从如下数据获取PublicPort和Image等数值列。感谢!

[#<Docker::Container:0x00000005195578 @id="8aba2f87cdf5e5d340f30fef8e5df8f58d990eab1c70583d4fef3a8fa83de3f2", @info={"Command"=>"/bin/bash", "Created"=>1427722904, "Image"=>"ddddd:latest", "Names"=>["/clever_pike"], "Ports"=>[{"IP"=>"0.0.0.0", "PrivatePort"=>80, "PublicPort"=>10280, "Type"=>"tcp"}], "Status"=>"Up 10 days", "id"=>"8aba2f87cdf5e5d340f30fef8e5df8f58d990eab1c70583d4fef3a8fa83de3f2"}, @connection=#<Docker::Connection:0x00000004aaadf8 @url="unix:///", @options={:socket=>"/var/run/docker.sock"}>>, #<Docker::Container:0x00000005195488 @id="c95642d254f1b716debbc8f5381b1234aff69c92db87a43e9b6f64216d1471b3", @info={"Command"=>"/bin/bash", "Created"=>1427722902, "Image"=>"bbbbbbb:latest", "Names"=>["/serene_heisenberg"], "Ports"=>[{"IP"=>"0.0.0.0", "PrivatePort"=>80, "PublicPort"=>10180, "Type"=>"tcp"}], "Status"=>"Up 10 days", "id"=>"c95642d254f1b716debbc8f5381b1234aff69c92db87a43e9b6f64216d1471b3"}, @connection=#<Docker::Connection:0x00000004aaadf8 @url="unix:///", @options={:socket=>"/var/run/docker.sock"}>>, #<Docker::Container:0x00000005195398 @id="5583df725fa5917eee6609210fee422d6d1d0059f8a9c630bdbf407d6cd014fc", @info={"Command"=>"/bin/bash", "Created"=>1427722900, "Image"=>"xxxxx:latest", "Names"=>["/adoring_franklin"], "Ports"=>[{"IP"=>"0.0.0.0", "PrivatePort"=>80, "PublicPort"=>10080, "Type"=>"tcp"}], "Status"=>"Up 10 days", "id"=>"5583df725fa5917eee6609210fee422d6d1d0059f8a9c630bdbf407d6cd014fc"}, @connection=#<Docker::Connection:0x00000004aaadf8 @url="unix:///", @options={:socket=>"/var/run/docker.sock"}>>]
PHP中文网
PHP中文网

认证0级讲师

membalas semua(1)
巴扎黑

Mengeluh, letak sahaja objek itu selepas memeriksa dan bertanya terus, anda memang malas

Anda tidak menyatakan pustaka yang anda gunakan Jika ada perpustakaan dan ada dokumentasi, lihat dokumentasi Jika tiada dokumentasi, lihat kod sumber Tiada konteks tentang cara objek anda dicipta

Mengenai soalan

Maklumat yang anda peroleh nampaknya berada dalam pembolehubah instance @info

Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan