method
to_h
Ruby latest stable (v2_5_5)
-
0 notes -
Class: WIN32OLE_RECORD
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
to_h()
public
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}