Class: Msf::Util::DotNetDeserialization::Types::Record

Inherits:
BinData::Record
  • Object
show all
Defined in:
lib/msf/util/dot_net_deserialization/types.rb,
lib/msf/util/dot_net_deserialization/types.rb

Overview

.NET Serialization Types (Compound-Records)

Class Method Summary collapse

Class Method Details

.from_value(record_value, parent: nil) ⇒ Object

Raises:

  • (::ArgumentError)

41
42
43
44
45
46
47
48
49
50
# File 'lib/msf/util/dot_net_deserialization/types.rb', line 41

def self.from_value(record_value, parent: nil)
  raise ::ArgumentError, 'Parameter record_value is invalid' unless record_value.class.const_defined?('RECORD_TYPE')

  args = [{record_type: record_value.class::RECORD_TYPE, record_value: record_value}]
  unless parent.nil?
    args << {}       # params
    args <<  parent  # parent object
  end
  self.new(*args)
end