https://github.com/raviqqe/block-is-hash
Block is Hash (See also https://github.com/raviqqe/block-is-array)
https://github.com/raviqqe/block-is-hash
metaprogramming ruby
Last synced: 6 months ago
JSON representation
Block is Hash (See also https://github.com/raviqqe/block-is-array)
- Host: GitHub
- URL: https://github.com/raviqqe/block-is-hash
- Owner: raviqqe
- License: unlicense
- Created: 2016-10-23T01:34:35.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-10-28T14:22:35.000Z (over 9 years ago)
- Last Synced: 2025-10-07T12:55:21.925Z (7 months ago)
- Topics: metaprogramming, ruby
- Language: Ruby
- Homepage:
- Size: 25.4 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# block-is-hash
[](https://travis-ci.org/raviqqe/block-is-hash)
[](https://unlicense.org)
Block is Hash
## Installation
```
$ gem install block-is-hash
```
## Usage
Code:
```ruby
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:
```ruby
{:user=>:www, :http=>{:server=>[{:listen=>80, :server_name=>"foo.com"}, {:listen=>[443, :ssl], :server_name=>"bar.com"}]}}
```
For more examples, see [examples](examples) directory.
## License
[The Unlicense](https://unlicense.org)