Method: WIN32OLE::Record#to_h
- Defined in:
- win32ole_record.c
#WIN32OLE::Record ⇒ Object
Returns Ruby Hash object which represents VT_RECORD variable. The keys of Hash object are member names of VT_RECORD OLE variable and the values of Hash object are values of VT_RECORD OLE variable.
If COM server in VB.NET ComServer project is the following:
Imports System.Runtime.InteropServices
Public Class ComClass
Public Structure Book
<MarshalAs(UnmanagedType.BStr)> _
Public title As String
Public cost As Integer
End Structure
Public Function getBook() As Book
Dim book As New Book
book.title = "The Ruby Book"
book.cost = 20
Return book
End Function
End Class
then, the result of WIN32OLE::Record#to_h is the following:
require 'win32ole'
obj = WIN32OLE.new('ComServer.ComClass')
book = obj.getBook
book.to_h # => {"title"=>"The Ruby Book", "cost"=>20}
357 358 359 360 361 |
# File 'win32ole_record.c', line 357 static VALUE folerecord_to_h(VALUE self) { return rb_ivar_get(self, rb_intern("fields")); } |