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 (
rankles /
| name | age | message | |
|---|---|---|---|
| |
.document | ||
| |
.gitignore | ||
| |
LICENSE | ||
| |
README.rdoc | ||
| |
Rakefile | ||
| |
VERSION | ||
| |
lib/ | ||
| |
rankles.gemspec | ||
| |
spec/ |
README.rdoc
rankles
Rankles is a collection of ranking algorithms (technically only one at the moment) implemented in Ruby.
The idea is simple. Give Rankles some data, and it will give you a number. You probably want to sort based on this number.
Quick example:
reddit = Rankles::Reddit.new :date => entry.published_at,
:upvotes => entry.cached_upvotes_count,
:downvotes => entry.cached_downvotes_count
reddit.to_f
If you’re dealing with ActiveRecord objects, you can actually assign the Rankles object to a float field, and it will handle converstion:
class Entry < ActiveRecord::Base
# ommitted
def calculate_ranking
reddit_ranking = Rankles::Reddit.new :date => entry.published_at,
:upvotes => entry.cached_upvotes_count,
:downvotes => entry.cached_downvotes_count
update_attributes! :ranking => reddit_ranking
end
end
Copyright
Copyright © 2009 Josh Nichols. See LICENSE for details.








