Assignement to UNO Sequence using index operator fails in Ruby

Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Assignement to UNO Sequence using index operator fails in Ruby

aarti.mahajan
This post has NOT been accepted by the mailing list yet.
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.


Thanks & Regards,
Aarti