Move Ruby fielded object creation from generated constructor to ThriftStruct
authorDavid Reiss <dreiss@apache.org>
Tue, 26 Feb 2008 06:40:22 +0000 (06:40 +0000)
committerDavid Reiss <dreiss@apache.org>
Tue, 26 Feb 2008 06:40:22 +0000 (06:40 +0000)
commit68ccc699a398ed47cde0ad1d405f94241fed6068
tree2a073766f174b8a2997b1cd4d6e7a250b35f8265
parentebbfbd83956e3e85c9be7b419b0f4d2748f866e7
Move Ruby fielded object creation from generated constructor to ThriftStruct

Rather than the generated code needing to handle simple fielded
creation of objects, the ThriftStruct module constructor is extended to
handle hash arguments. Statements such as

  o = ThriftObject.new :field1 => value1, :field2 => value2, ...

are supported as before, and the string form,

  o = ThriftObject.new "field1" => value1, "field2" => value2, ...

disabled by the previous patch now also works.

Placing this code in the module is also just a cleaner solution.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665502 13f79535-47bb-0310-9956-ffa450edef68
compiler/cpp/src/generate/t_rb_generator.cc
lib/rb/lib/thrift/thrift.rb