Class: Casper::Entity::DeployExecutableTransfer

Inherits:
DeployExecutableItemInternal show all
Defined in:
lib/entity/deploy_executable_transfer.rb

Instance Attribute Summary

Attributes inherited from DeployExecutableItemInternal

#args

Instance Method Summary collapse

Methods inherited from DeployExecutableItemInternal

#get_arg_by_name, #set_arg

Constructor Details

#initialize(args) ⇒ DeployExecutableTransfer

Returns a new instance of DeployExecutableTransfer.

Parameters:



23
24
25
26
# File 'lib/entity/deploy_executable_transfer.rb', line 23

def initialize(args)
  @tag = 5
  @args = args
end

Instance Method Details

#get_argsObject



32
33
34
# File 'lib/entity/deploy_executable_transfer.rb', line 32

def get_args
  @args 
end

#get_tagObject



28
29
30
# File 'lib/entity/deploy_executable_transfer.rb', line 28

def get_tag
  @tag
end

#to_bytesObject



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/entity/deploy_executable_transfer.rb', line 36

def to_bytes
  serializer = DeployNamedArgSerializer.new
  num_of_args = @args.length
  bytes = Utils::ByteUtils.to_u8(@tag) + Utils::ByteUtils.to_u32(num_of_args)

  @args.each do |arg|
    arg.each do |item|
      bytes += serializer.to_bytes(item)
    end
  end
  Utils::ByteUtils.hex_to_byte_array(bytes)
end