# File lib/rubytorrent/metainfo.rb, line 166 def self.from_bstream(bs) dict = nil bs.each do |e| if dict == nil dict = e else raise MetaInfoFormatError, "too many bencoded elements for metainfo file (just need one)" end end raise MetaInfoFormatError, "bencoded element must be a dictionary, got a #{dict.class}" unless dict.kind_of? ::Hash MetaInfo.new(dict) end