Sha256: 1433659e6d3476c63cd780c275228d55539d2c9a63d67235463ed1264400e8c2

Contents?: true

Size: 446 Bytes

Versions: 2

Compression:

Stored size: 446 Bytes

Contents

module BEncodr
  module IO
    module ClassMethods
      def bencode(fd, object)
        open(fd, "wb") {|file| file.bencode(object)}
      end
      
      def bdecode(fd)
        open(fd, "rb") {|file| file.bdecode}
      end
    end
    
    def bencode(object)
      write(Object.bencode(object))
    end
    
    def bdecode
      Object.bdecode(read)
    end
    
    def self.included(base)
      base.extend ClassMethods
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bencodr-2.0.1 lib/bencodr/io.rb
bencodr-2.0.0 lib/bencodr/io.rb