irb(main):016:0> @command = begin
irb(main):017:1* Hash.new{|h, k| h[k] = Array.new}
irb(main):018:1> end
=> {}
irb(main):019:0> @command[:a]
=> []
irb(main):020:0> @command
=> {:a=>[]}
irb(main):021:0> @com = Hash.new
=> {}
irb(main):022:0> @com[:a]
=> nil
irb(main):023:0> @com
=> {}
irb(main):024:0>
create ruby hash using block
最新推荐文章于 2024-09-03 10:45:11 发布