From: Andreas Lundgren Date: 2011-05-23T21:55:26+09:00 Subject: Re: Generating Functions in Ruby Hi, and thank you all! Yes, the example is far from reallity in one sense, but your example really did the trick and conceptually it's the same! So, for the interessted reader, I will provide my code here. (I have a similar method for setting values.) Via an Ole32 server i communicate with a sw that can extract all types of data from a odd type of database. (My final dilemma is how to get the value of STUB_CALLS into Templates.rb by defining it in my test program Impl.rb. To define it direcrly in the template file in not very nice... And of cause I don't want to have to define it at all when running in non-test-mode.) ______Templates.rb______ STUB_CALLS = 1; # If this is '1', all instruments are stubed for debugging purpouse def GET_VALUE(f_name, method, return_format, no_of_params) # Make a parameter list and an argument list if 0'); end" end end ______Templates.rb______ <- this is just three out of many methods... require '.\Difinitions.rb' #***ParamsList ["database"] GET_VALUE('customer_getFrequency', 'getcustomerfreq', 'ResultDbl', 1) #***ParamsList ["database"] GET_VALUE('customer_getSpend_thr', 'getcustspend', 'ResultDbl', 1) #***ParamsList ["database", "start", "stop", "inc"] GET_VALUE('shop_GetFundReq', 'getfundreq', 'ResultDbl', 4) ______Impl.rb______ <- The implementation does already exist, and it's huge. This is just a few lines from my test program: require '.\Difinitions.rb' f = customer_getFrequency(cdb) s = customer_getSpend_thr(cdb) fr = shop_GetFundReq(sdb, 20110101, 20110201, 'all')