Class: MTP::Properties::Forms::None

Inherits:
Object
  • Object
show all
Defined in:
lib/mtp/properties.rb

Instance Method Summary collapse

Constructor Details

#initialize(form, dts) ⇒ None

Returns a new instance of None.



139
140
# File 'lib/mtp/properties.rb', line 139

def initialize(form, dts)
end

Instance Method Details

#pack(datatype, dts, value) ⇒ Object



152
153
154
155
156
157
158
159
160
# File 'lib/mtp/properties.rb', line 152

def pack(datatype, dts, value)
  if datatype.name == "String"
    [ value ].pack("J")
  elsif (datatype & 0x4000) == 0x4000
    [ value ].pack("#{dts}+")
  else
    [ value ].pack("#{dts}")
  end
end

#unpack(datatype, dts, raw_value) ⇒ Object



142
143
144
145
146
147
148
149
150
# File 'lib/mtp/properties.rb', line 142

def unpack(datatype, dts, raw_value)
  if datatype.name == "String"
    raw_value.unpack("J").first
  elsif (datatype & 0x4000) == 0x4000
    raw_value.unpack("#{dts}+").first
  else
    raw_value.unpack("#{dts}").first
  end
end