Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/rubytorrent/bencoding.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.bencoded?(c) ⇒ Boolean
136 137 138 |
# File 'lib/rubytorrent/bencoding.rb', line 136 def self.bencoded?(c) c == ?l end |
.parse_bencoding(c, s) ⇒ Object
140 141 142 143 144 |
# File 'lib/rubytorrent/bencoding.rb', line 140 def self.parse_bencoding(c, s) ret = RubyTorrent::BStream.new(s).map { |x| x } raise RubyTorrent::BEncodingError, "missing list terminator" unless s.getc == ?e ret end |
Instance Method Details
#to_bencoding ⇒ Object
132 133 134 |
# File 'lib/rubytorrent/bencoding.rb', line 132 def to_bencoding "l" + self.map { |e| e.to_bencoding }.join + "e" end |