Class: MTP::Properties::Forms::None
- Inherits:
-
Object
- Object
- MTP::Properties::Forms::None
- Defined in:
- lib/mtp/properties.rb
Direct Known Subclasses
ByteArray, DateTime, Enumeration, FixedLengthArray, LongString, Range, RegularExpression
Instance Method Summary collapse
-
#initialize(form, dts) ⇒ None
constructor
A new instance of None.
- #pack(datatype, dts, value) ⇒ Object
- #unpack(datatype, dts, raw_value) ⇒ Object
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 |