I'm using the send() method in Ruby to invoke a method I've defined. The method takes an OpenStruct.
Here's a snippet showing how I invoke my method using send:
my_open_struct = OpenStruct.new(foo: "foo")
result = @my_object.send(
:my_method_that_takes_an_openstruct,
name_of_openstruct_param: my_open_struct)
The problem is that inside my_method_that_takes_an_openstruct the OpenStruct param is getting wrapped in a Hash, resulting in logging output like this:
Just before calling send #<OpenStruct foo="foo">
Inside my_method_that_takes_an_openstruct: {:name_of_openstruct_param=>#<OpenStruct foo="foo">}
Why is this happening, and how can I prevent this wrapping behaviour?