Class: MTP::ParametersContainer

Inherits:
Container show all
Defined in:
lib/mtp/container.rb

Direct Known Subclasses

Request, Response

Instance Attribute Summary collapse

Attributes inherited from Container

#code, #length, #length_read, #payload, #transaction_id

Instance Method Summary collapse

Methods inherited from Container

#pack, #pack_header, parse, #to_s, #type

Constructor Details

#initializeParametersContainer

Returns a new instance of ParametersContainer.



54
55
56
57
# File 'lib/mtp/container.rb', line 54

def initialize
  super
  @parameters = []
end

Instance Attribute Details

#parametersObject

Returns the value of attribute parameters.



53
54
55
# File 'lib/mtp/container.rb', line 53

def parameters
  @parameters
end

Instance Method Details

#pack_payloadObject



59
60
61
# File 'lib/mtp/container.rb', line 59

def pack_payload
  @parameters.pack_without_mtp("I*") 
end

#payload=(payload) ⇒ Object



63
64
65
66
# File 'lib/mtp/container.rb', line 63

def payload=(payload)
  @payload = payload
  @parameters = payload.unpack("I*")
end