Class: Stargate::Codec::BEncode
- Inherits:
-
Object
- Object
- Stargate::Codec::BEncode
- Defined in:
- lib/stargate/codec/bencode.rb
Overview
Internal: BEncode (BitTorrent encoding) powered codec.
Class Method Summary collapse
Class Method Details
.content_type ⇒ Object
11 12 13 |
# File 'lib/stargate/codec/bencode.rb', line 11 def self.content_type 'application/bencode' end |
.decode(str) ⇒ Object
19 20 21 22 23 |
# File 'lib/stargate/codec/bencode.rb', line 19 def self.decode(str) ::BEncode::Parser.new(str).parse! rescue ::BEncode::DecodeError => err raise DecodeError, "Arguments cannot be decoded: bencode parser error" end |
.encode(obj) ⇒ Object
15 16 17 |
# File 'lib/stargate/codec/bencode.rb', line 15 def self.encode(obj) obj.bencode end |
.id ⇒ Object
7 8 9 |
# File 'lib/stargate/codec/bencode.rb', line 7 def self.id :bencode end |