block-is-hash

Block is Hash (See also https://github.com/raviqqe/block-is-array)

UNLICENSE License

Downloads
8.7K
Stars
7
Committers
1

block-is-hash

Block is Hash

Installation

$ gem install block-is-hash

Usage

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.

License

The Unlicense