Module: RubyTorrent::StringToBarray

Includes:
StringMapBytes
Defined in:
lib/rubytorrent/peer.rb

Instance Method Summary collapse

Methods included from StringMapBytes

#map_bytes

Instance Method Details

#to_barrayObject



53
54
55
56
57
# File 'lib/rubytorrent/peer.rb', line 53

def to_barray
  self.map_bytes do |b|
    (0 .. 7).map { |i| (b & (1 << (7 - i))) != 0 }
  end.flatten
end