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

Constructor Details

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

Returns a new instance of FileStart.



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

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.



46
47
48
# File 'lib/nanite/packets.rb', line 46

def dest
  @dest
end

#filenameObject

Returns the value of attribute filename.



46
47
48
# File 'lib/nanite/packets.rb', line 46

def filename
  @filename
end

#tokenObject

Returns the value of attribute token.



46
47
48
# File 'lib/nanite/packets.rb', line 46

def token
  @token
end

Class Method Details

.json_create(o) ⇒ Object



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

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

Instance Method Details

#to_sObject



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

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