This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Run the following if you haven't already:
gem sources -a http://gems.github.com
Install the gem(s):
sudo gem install linkingpaths-alea
alea /
| name | age | message | |
|---|---|---|---|
| |
HISTORY | ||
| |
LICENSE | ||
| |
Manifest.txt | Sat Oct 04 09:45:24 -0700 2008 | |
| |
POSTINSTALL | ||
| |
README.markdown | Sat Oct 04 09:39:17 -0700 2008 | |
| |
Rakefile | Sat Sep 20 16:55:08 -0700 2008 | |
| |
alea.gemspec | Sat Oct 04 09:45:24 -0700 2008 | |
| |
config/ | ||
| |
lib/ | ||
| |
test/ | Sat Oct 04 09:39:17 -0700 2008 |
alea
alea is a tiny gem that aim to bring some aleatory behavior to ruby Kernel.
Alea - Greek soldier (From Wikipedia, the free encyclopedia): "Alea was a Greek soldier who reputedly invented the dicing game 'Tabula'.This is the origin of the name aléatoire, meaning random.
Install
´sudo gem install linkingpaths-alea´
The junk
require 'alea'
# Add between 10 and 25 friends to a user
@user.add_friends rand_within(10..25)
# 75% chances of this happens
frequently do
update_profile(@user)
end
# 65% chances of this happens
probably do
@group.activate!
end
# 20% chances of this happens
rarely do
generate_404
end
# 5% chances of this happens
almost_never do
grant_admin_privileges(@user)
end
# 95% chances of this happens
almost_always do
post_incorrect_data_for_captcha
end
# 50% chances of true
@group.moderated = maybe
# Calculate rounded percents
send_mail_to 20.percent.of(the_community)
PS: I will probably give the option of set custom % via Alea::PROBABLY, Alea::RARELY etc. soon.
Credits
This code is based and inspired on some chunks of code appeared on the always entertaining, brilliant and funny project.ioni.st tumblelog.
More
http://github.com/linkingpaths/alea
http://github.com/linkingpaths/alea/wikis
Copyright (c) 2008 Linking Paths, released under the MIT license













