Class: Nanite::FileChunk
Overview
packet that carries data chunks during a file transfer
Instance Attribute Summary collapse
-
#chunk ⇒ Object
Returns the value of attribute chunk.
-
#token ⇒ Object
Returns the value of attribute token.
Attributes inherited from Packet
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(token, size = nil, chunk = nil) ⇒ FileChunk
constructor
A new instance of FileChunk.
- #to_s ⇒ Object
Methods inherited from Packet
Constructor Details
#initialize(token, size = nil, chunk = nil) ⇒ FileChunk
Returns a new instance of FileChunk.
92 93 94 95 96 |
# File 'lib/nanite/packets.rb', line 92 def initialize(token, size=nil, chunk=nil) @chunk = chunk @token = token @size = size end |
Instance Attribute Details
#chunk ⇒ Object
Returns the value of attribute chunk.
90 91 92 |
# File 'lib/nanite/packets.rb', line 90 def chunk @chunk end |
#token ⇒ Object
Returns the value of attribute token.
90 91 92 |
# File 'lib/nanite/packets.rb', line 90 def token @token end |
Class Method Details
.json_create(o) ⇒ Object
98 99 100 101 |
# File 'lib/nanite/packets.rb', line 98 def self.json_create(o) i = o['data'] new(i['token'], o['size'], i['chunk']) end |
Instance Method Details
#to_s ⇒ Object
103 104 105 |
# File 'lib/nanite/packets.rb', line 103 def to_s "#{super} <#{token}>" end |