Class: Casper::Entity::ModuleBytes
- Inherits:
-
DeployExecutableItemInternal
- Object
- DeployExecutableItemInternal
- Casper::Entity::ModuleBytes
- Defined in:
- lib/entity/module_bytes.rb
Instance Attribute Summary
Attributes inherited from DeployExecutableItemInternal
Instance Method Summary collapse
- #get_args ⇒ Object
- #get_module_bytes ⇒ Object
- #get_tag ⇒ Object
-
#initialize(module_bytes = nil, args = []) ⇒ ModuleBytes
constructor
A new instance of ModuleBytes.
- #set_arg(deploy_named_arg) ⇒ Object
- #to_bytes ⇒ Object
Methods inherited from DeployExecutableItemInternal
Constructor Details
#initialize(module_bytes = nil, args = []) ⇒ ModuleBytes
Returns a new instance of ModuleBytes.
9 10 11 12 13 |
# File 'lib/entity/module_bytes.rb', line 9 def initialize(module_bytes=nil, args = []) @tag = 0 @module_bytes = module_bytes @args = args end |
Instance Method Details
#get_args ⇒ Object
23 24 25 |
# File 'lib/entity/module_bytes.rb', line 23 def get_args @args end |
#get_module_bytes ⇒ Object
19 20 21 |
# File 'lib/entity/module_bytes.rb', line 19 def get_module_bytes @module_bytes end |
#get_tag ⇒ Object
15 16 17 |
# File 'lib/entity/module_bytes.rb', line 15 def get_tag @tag end |
#set_arg(deploy_named_arg) ⇒ Object
27 28 29 |
# File 'lib/entity/module_bytes.rb', line 27 def set_arg(deploy_named_arg) @args << [deploy_named_arg] end |
#to_bytes ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/entity/module_bytes.rb', line 31 def to_bytes bytes = "" serializer = DeployNamedArgSerializer.new num_of_args = @args.length bytes += Utils::ByteUtils.to_u8(@tag) if @module_bytes == "" bytes += Utils::ByteUtils.to_u32(0) end bytes += 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 |