Assigning to UNO Sequence using index operator fails in Ruby

Java, C++, C#, Delphi, ??? - Using the UNO bridges

Assigning to UNO Sequence using index operator fails in Ruby

Postby aarti.mahajan » Thu Aug 29, 2013 2:48 pm

Hi All,

I have a UNO-Ruby Bridge implementation which allows implementation of Uno components using Ruby. However I encountered a corner case in the following scenario. In IDL file, I have a uno struct (i.e Book) containing a member of the type UNO Sequence (i.e data).
1. When we use following approach to assign values to Book.data member, it
works:

setValue = Svc::Rubyunobridge::Test::Book.new
setValue.No = 1
setValue.Name = "ABC"
dataElements = Array.new
dataElements << 0x40 << 0x0 << 0x07 << 0x0 setValue.data = dataElements

Following is the reason why above assignment works:
a. UNO-Ruby Bridge is built upon method_missing(). Whenever any new construct is encountered in Ruby script, Ruby invokes method_missing() by passing appropriate arguments to this method.
b. In above scenario, method_missing() gets parameter methodName as "data="
and args as "dataElements". If methodName ends with a '=' (in this case it does), value of args is assigned to methodName.

2. When we use following approach to assign values to Book.data member, it gives unexpected result.

setValue.data[0] = 0x40
setValue.data[1] = 0x0
setValue.data[2] = 0x07
setValue.data[3] = 0x0

In this case, Ruby invokes method_missing(), however arguments to this
method_missing() are not getting populated correctly from Ruby.
In this case inside method_missing(), we get parameter methodName as "data"
and args as empty. Thus the assignment fails.

Our interest is to make above mentioned second approach work.

Is there any way this can be achieved?
Can we debug how the parsing happens and how the arguments sent to
method_missing() are populated?
Any help/pointers are much appreciated.
OpenOffice version 3.1
RHEL 5.8
aarti.mahajan
 
Posts: 1
Joined: Thu Aug 29, 2013 10:48 am

Return to External Programs

Who is online

Users browsing this forum: No registered users and 1 guest