Sha256: f950371c453d860d4fcf8df1162ecad42a2342ddf9a8c98dfc9c127fab05b84e

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

# BlockChain

[![Build Status](https://secure.travis-ci.org/amarshall/block_chain.png)](http://travis-ci.org/amarshall/block_chain)

Makes it easy to chain nested blocks together without creating a ton of nesting.

## Installation

Install as usual: `gem install block_chain` or add `gem 'block_chain'` to your Gemfile.

## Usage

Turn this:

```ruby
foo do
  bar do
    baz do
      qux do
        yield
      end
    end
  end
end
```

into this:

```ruby
require 'block_chain'
BlockChain.new(method(:foo), method(:bar), method(:baz), method(:qux)).call { yield }
```

or:

```ruby
require 'block_chain'
methods = [:foo, :bar, :baz, :qux].map { |name| method name }
BlockChain.new(*methods).call { yield }
```

This can make deeply-nested block wrappings a bit more digestable.

## Contributing

Contributions are welcome. Please be sure that your pull requests are atomic so they can be considered and accepted separately.

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## Credits & License

Copyright © 2013 J. Andrew Marshall. License is available in the LICENSE file.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
block_chain-0.1.0 README.md