Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Yaml Callback library that makes reading config files much easier

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 LICENSE
Octocat-spinner-32 Rakefile
Octocat-spinner-32 railsonfire.yml
Octocat-spinner-32 yack.gemspec

Yack Railsonfire Status for flomotlik/yack

Yack (Yet another callback kit) is a library to create simple callbacks for your Hashes. It is especially useful when loading config files. Instead of pulling the values out of the config file you simply add callbacks and when the attributes exist in the Hash a code block is run.


gem install yack


Consider you have the following YAML File

  :child: "TestString"

Simply create a new callback object

yack =

then simply add some callbacks

yack.parent.child do |value|
  //value is "TestString"

and start the processing


Your Code block will be called with the value of the attribute which in the last example would be "TestString".

As it processes Hashes directly you can use JSON, Yaml or any other format that can be represented by a Hash. Currently only on callback can be registered for a specific point in the hash.

If you want your code block to handle a child hash this is also possible by only adding a callback for the parent

yack.parent do |value|
  //value is {:test => "TestString"}

Will be called with {:test => "TestString"} considering the example before.

If you want to add callbacks for several child attributes simply add several callbacks

  :child1: 1
  :child2: 2

The following code blocks will be called with the correct attributes:

yack.parent.child1 do |value|
  //value is 1

yack.parent.child2 do |value|
  //value is 2


Copyright (c) 2012 Florian Motlik.

Released under the MIT license. See LICENSE for details.

Something went wrong with that request. Please try again.