Method: FFIDB::Struct#to_h

Defined in:
lib/ffidb/struct.rb

#to_hHash<Symbol, Type>

Returns:

  • (Hash<Symbol, Type>)


33
34
35
36
37
38
39
# File 'lib/ffidb/struct.rb', line 33

def to_h
  {
    name: self.name.to_s,
    comment: self.comment,
    fields: self.opaque? ? nil : self.fields&.transform_values { |t| t.to_s },
  }.delete_if { |k, v| v.nil? }
end