Class: Nanite::FileChunk

Inherits:
Packet show all
Defined in:
lib/nanite/packets.rb

Overview

packet that carries data chunks during a file transfer

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Packet

#to_json

Constructor Details

#initialize(token, chunk = nil) ⇒ FileChunk

Returns a new instance of FileChunk.



50
51
52
53
# File 'lib/nanite/packets.rb', line 50

def initialize(token, chunk=nil)
  @chunk = chunk
  @token = token
end

Instance Attribute Details

#chunkObject

Returns the value of attribute chunk.



49
50
51
# File 'lib/nanite/packets.rb', line 49

def chunk
  @chunk
end

#tokenObject

Returns the value of attribute token.



49
50
51
# File 'lib/nanite/packets.rb', line 49

def token
  @token
end

Class Method Details

.json_create(o) ⇒ Object



54
55
56
57
# File 'lib/nanite/packets.rb', line 54

def self.json_create(o)
  i = o['data']
  new(i['token'], i['chunk'])
end