Block is Hash (See also https://github.com/raviqqe/block-is-array)
UNLICENSE License
Block is Hash
$ gem install block-is-hash
Code:
require 'block-is-hash'
hash = block_is_hash %i(server) do # `server` directive can be repeated.
user :www
http do
server do
listen 80
server_name 'foo.com'
end
server do
listen 443, :ssl
server_name 'bar.com'
end
end
end
p hash
Output:
{:user=>:www, :http=>{:server=>[{:listen=>80, :server_name=>"foo.com"}, {:listen=>[443, :ssl], :server_name=>"bar.com"}]}}
For more examples, see examples directory.