From: yermej Date: 2010-07-12T06:05:06+09:00 Subject: Re: How to pass a hash as a param to a method called through eval? On Jul 11, 2:57 pm, Alex Stahl wrote: [...] > Problem is that 'call['params']' is treated as a string by the receiver, > not the hash I intended to pass.  Tried using casting operations first, > like .to_s and then .to_hash, but the to_hash call fails w/ no method > error.  Instead the hash comes through as a string.  How can I pass it > so that it remains a hash, and retains its structure for key/val reading > in the receiver? > This will do it: eval("#{call['action']}(call['params'])") Depending on context, you can probably completely avoid using eval: method(call['action']).call(call['params']) When you use #{call['params']}, I think that calls #to_s on the Hash which causes what you're seeing. Jeremy