thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens Geyer" <>
Subject Re: Ruby : How to get thrift type of attribute ?
Date Mon, 02 Jun 2014 19:43:27 GMT

-----Urspr√ľngliche Nachricht----- 
From: Alexis Gryta
Sent: Monday, June 2, 2014 7:54 PM
Subject: Ruby : How to get thrift type of attribute ?

Hi everybody !

I would like to process many attributes automatically.
But my data are read from a file and they are string type...
I would like to know if there is a solution to know the type of attribute.
Thanks to this, I'll be able to convert string into the right type.

struct Test{
1: i32 id,
2: string name,
3: Enumeration genre

test =
A method which does (for example) :
puts  => Give me i32
puts test.string.type  => Give me string

I can use but it doesn't work .. (tell me nilClass when it
isn't assigned)
And even if "id" is a i32, = "blabla"  => works... (normally, it shouldn't)
The verification of type is done only when you try to serialize... not when
you assign a value into a thrift object.

Thank you ! 

View raw message