github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

technicalpickles / rankles

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 4
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (2)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (2)
    • v0.0.2
    • v0.0.1
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Ranking algorithms. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Hrm, why no version update? 
technicalpickles (author)
Thu May 14 20:40:29 -0700 2009
commit  3d92339eec1067b257363ea20e0ef70198a7c706
tree    54e1cd5cdb83df4d702823b7fcb9c24a9744d964
parent  7296d30af69eb747ea149480a66d409c34d4c5d9
rankles /
name age
history
message
file .document Loading commit data...
file .gitignore
file LICENSE
file README.rdoc
file Rakefile
file VERSION
directory lib/
file rankles.gemspec
directory 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.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server