Fossyl Build Status Code Climate

Pre-historic Bencoding

Installation

Add this line to your application's Gemfile:

gem 'fossyl'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fossyl

Usage

require "fossyl"

# Encoding
Fossyl.dump("bytes")                    # => "5:bytes"
Fossyl.dump(12)                         # => "i12e"
Fossyl.dump([1, "two", 3])              # => "li1e3:twoi3ee"
Fossyl.dump(a: 1, b: "two", c: [1])     # => "d1:ai1e1:b3:two1:cli1eee"

# Decoding
Fossyl.load("5:bytes")                  # => "bytes"
Fossyl.load("i12e")                     # => 12
Fossyl.load("li1e3:twoi3ee")            # => [1, "two", 3]
Fossyl.load("d1:ai1e1:b3:two1:cli1eee") # => { "a" => 1, "b" => "two", "c" => [1] }

Supported Platforms

  • Ruby 2.0.x

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Copyright (c) 2012 Adam Tanner. See License for details.