Sha256: fe0eea02228b44d99dc81877317041fb36202098b1d46b1de41f743f2b4c8c9a

Contents?: true

Size: 448 Bytes

Versions: 2

Compression:

Stored size: 448 Bytes

Contents

# encoding: UTF-8

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-3.0.2 lib/bencodr/io.rb
bencodr-3.0.1 lib/bencodr/io.rb