Fossyl
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
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Copyright
Copyright (c) 2012 Adam Tanner. See License for details.