Class: Nanite::FileStart

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

Overview

packet that means start of a file transfer operation

Instance Attribute Summary collapse

Attributes inherited from Packet

#size

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Packet

#id_to_s, #to_json, #wrap

Constructor Details

#initialize(filename, dest, token, size = nil) ⇒ FileStart

Returns a new instance of FileStart.



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

def initialize(filename, dest, token, size=nil)
  @filename = filename
  @dest = dest
  @token = token
  @size = size
end

Instance Attribute Details

#destObject

Returns the value of attribute dest.



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

def dest
  @dest
end

#filenameObject

Returns the value of attribute filename.



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

def filename
  @filename
end

#tokenObject

Returns the value of attribute token.



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

def token
  @token
end

Class Method Details

.json_create(o) ⇒ Object



60
61
62
63
# File 'lib/nanite/packets.rb', line 60

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

Instance Method Details

#to_sObject



65
66
67
# File 'lib/nanite/packets.rb', line 65

def to_s
  wrap("#{super} <#{token}> #{filename} to #{dest}")
end