Is it a valid Ruby Mash syntax? -


i find below mash declared in readme of https://github.com/hw-cookbooks/haproxy :

haproxy 'myhaproxy'   config mash.new(     :global => {       :maxconn => node[:haproxy][:global_max_connections],       :user => node[:haproxy][:user],       :group => node[:haproxy][:group]     },     :defaults => {       :log => :global,       :mode => :tcp,       :retries => 3,       :timeout => 5     },     :frontend => {       :srvs => {         :maxconn => node[:haproxy][:frontend_max_connections],         :bind => "#{node[:haproxy][:incoming_address]}:#{node[:haproxy][:incoming_port]}",         :default_backend => :backend_servers       }     },     :backend => {       :backend_servers => {         :mode => :tcp,         :server => [           "an_node 192.168.99.9:9999" => {             :weight => 1,             :maxconn => node[:haproxy][:member_max_connections]           }         ]       }     }   ) end 

i wanted know below mash denote:

:server => [           "an_node 192.168.99.9:9999" => {             :weight => 1,             :maxconn => node[:haproxy][:member_max_connections]           }         ] 

is array of hash?

this valid ruby syntax , yes, produce array 1 element, hash.

[   "an_node 192.168.99.9:9999" => {     :weight => 1,     :maxconn => node[:haproxy][:member_max_connections]   } ]  # => [{"an_node 192.168.99.9:9999"=>{:weight=>1, :maxconn=>2}}] 

mashes irrelevant here, way. mash.new accepts hash. if it's valid hash, result in valid mash. else error. code in question is valid ruby hash.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -