Sha256: 69d38c826c7eebcf38f06314fd858235bd4b70695fb488fe725ce7f39de057ea
Contents?: true
Size: 515 Bytes
Versions: 1
Compression:
Stored size: 515 Bytes
Contents
require "fossyl/version" require "fossyl/parser" module Fossyl InvalidBencoding = Class.new(StandardError) def self.dump(object) case object when String, Symbol "#{object.length}:#{object}" when Integer "i#{object}e" when Array list = object.map {|item| dump(item) }.join "l#{list}e" when Hash hash = object.sort.map {|key, value| dump(key) << dump(value) }.join "d#{hash}e" end end def self.load(string) Parser.new(string).parse end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fossyl-0.5.0 | lib/fossyl.rb |