Class: BigChungusTheChunkGetter
- Inherits:
-
Object
- Object
- BigChungusTheChunkGetter
- Defined in:
- lib/chunk.rb
Class Method Summary collapse
-
.get_chunks(data) ⇒ Array<NetChunk>
given a raw payload of a teeworlds packet it splits it into the indivudal chunks also known as messages.
Class Method Details
.get_chunks(data) ⇒ Array<NetChunk>
given a raw payload of a teeworlds packet it splits it into the indivudal chunks also known as messages
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/chunk.rb', line 162 def self.get_chunks(data) chunks = [] chunk = NetChunk.new(data) chunks.push(chunk) while chunk.next chunk = NetChunk.new(chunk.next) chunks.push(chunk) next unless chunks.size > MAX_NUM_CHUNKS # inf loop guard case puts 'Warning: abort due to max num chunks bein reached' break end chunks end |