Sprinkles

Build Status Dependency Status

Still Maintained

TL;DR gem install sprinkles

center


Installation

gem install sprinkles

Or with Bundler

# Add to Gemfile

gem 'sprinkles'

Dead Easy

require 'sprinkles/hash/autovivify'
require 'sprinkles/hash/has_keys'
require 'sprinkles/hash/threadsafe'


over_eager = Hash.auto # That's one happy hash.


# > a = {}
# {}
# > a[1][2][3] = 4
# 4
# > a[7] = 'a'
# 'a'
# > a.has_all_keys? 1, 7 # only if all keys are found
# true
# > a.has_all_keys? 1, 'other'
# false 
# > a.has_keys? 1, 'other' # if any keys are found
# true
# > a.has_keys? 1
# true
# > a.has_keys? 'bad', 'other'
# false

Other Ruby ways to do the same thing

require 'sprinkles'

sprinkles :hash => [ :has_keys, :autovivify, :threadsafe ] 

(or)

require 'sprinkles'

sprinkles 'hash/has_keys', 'hash/autovivify', 'hash/threadsafe'

(also works)

sprinkles 'hash/has_keys'
sprinkles 'hash/autovivify'
sprinkles 'hash/threadsafe'

(or require everything)

require 'sprinkles/taste/the/rainbow'

require 'sprinkles/nuclear/plant/inspector' 

# Just for fun, don't use in production plz plz.

Wiki

It's here

FAQ

  1. Q: Does the world really need another giant, heavy-weight mixin library?

    A: Not really. But, I've yet to find one as ridiculously overpowered as this. I'm sure you'll agree once you have thread-safe Hashes with 0 effort.

  2. Q: Dude, this sucks!

    A: Get a girlfriend

    More answers

Forking

Pull requests with specs are most likely to be accepted.

Topical branches: for the win.

Click here to fork

Help appreciated!

Please feel free to help out, no invitation needed!

Still stuck, somthing missing?

Ancient rubies

# At the very top
require 'rubygems'
require 'sprinkles'
...

Send a ticket if you're really stuck, we don't bite hard.

The royal 'we' will get right on that, just as soon as we can.

Feedback and flaming also appreciated. Hate is :heart: too. :)

Licensing

MIT license

Author

Barry Allard. Copyright 2012. All rights reserved that are not explicitly disclaimed by license.

Mahalo.