RubyTorrent is a pure-Ruby BitTorrent peer library and toolset. You can use it to download or serve files over BitTorrent from any Ruby program. RubyTorrent is primarily a library.
There are also a few executable scripts for you to play around with. rtpeer.rb: downloads a BitTorrent package. rtpeer-ncurses.rb: a nicer, ncurses version of the same. (The standard Ruby curses library appears not to play nicely with Threads, so we can't use it.) dump-metainfo.rb: takes a .torrent metainfo file and spits out everything about it. make-metainfo.rb: creates a .torrent file. dump-peers.rb: takes a .torrent metainfo file, connects to the tracker, and displays all the peers. (hack.)